151
return undefined;
152
}
154
>
const parsedButtons: IUpdateInfoButton[] = [];
155
>
for (const button of buttons) {
156
>
if (typeof button !== 'object' || button === null) {
157
continue;
158
}
160
>
if (!hasKey(button, { label: true, commandId: true }) || typeof button.label !== 'string' || typeof button.commandId !== 'string') {
161
continue;
162
}
163
164
>
const style = hasKey(button, { style: true }) && (button.style === 'primary' || button.style === 'secondary') ? button.style : undefined;
updateInfoParser.ts
165
>
const args = hasKey(button, { args: true }) && Array.isArray(button.args) ? button.args : undefined;
166
>
parsedButtons.push({
167
>
label: button.label,
168
>
commandId: button.commandId,
169
>
args,
170
>
style,
171
>
});
172
>
}
173
>
174
return parsedButtons.length ? parsedButtons : undefined;
175
}