@nodescript/stdlib
Version:
Standard Node Definitions
36 lines (35 loc) • 836 B
JavaScript
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);
};