UNPKG

@nodescript/stdlib

Version:
36 lines (35 loc) 836 B
export const module = { version: '1.1.4', moduleName: 'Array / Flatten', description: ` Returns an array with all sub-array elements concatenated into it recursively up to the specified depth. `, keywords: ['concatenate'], params: { array: { schema: { type: 'array', items: { type: 'array', items: { type: 'any' }, }, }, }, depth: { schema: { type: 'number', default: 1, }, }, }, result: { schema: { type: 'array', items: { type: 'any' }, } }, }; export const compute = params => { const { array, depth } = params; return array.flat(depth); };