mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-18 23:16:59 +01:00
19 lines
407 B
TypeScript
19 lines
407 B
TypeScript
import { TemplateFunction } from '@yaakapp/api';
|
|
|
|
export function migrateTemplateFunctionSelectOptions(f: TemplateFunction): TemplateFunction {
|
|
const migratedArgs = f.args.map((a) => {
|
|
if (a.type === 'select') {
|
|
a.options = a.options.map((o) => ({
|
|
...o,
|
|
label: o.label || (o as any).name,
|
|
}));
|
|
}
|
|
return a;
|
|
});
|
|
|
|
return {
|
|
...f,
|
|
args: migratedArgs,
|
|
};
|
|
}
|