UNPKG

@nodescript/stdlib

Version:
40 lines (39 loc) 929 B
export const module = { version: '1.1.3', moduleName: 'Array / Slice', description: ` Returns a portion of an array, starting and ending at specified indexes. Start index is inclusive, end index is exclusive. `, keywords: ['subsequence', 'sublist'], params: { array: { schema: { type: 'array', items: { type: 'any' }, }, }, start: { schema: { type: 'number', default: 0, }, }, end: { schema: { type: 'number', default: Infinity, }, }, }, result: { schema: { type: 'array', items: { type: 'any' }, } }, }; export const compute = params => { const { array, start, end } = params; return array.slice(start, end); };