UNPKG

@nodescript/stdlib

Version:
37 lines (36 loc) 819 B
export const module = { version: '1.0.3', moduleName: 'Object / Omit', description: ` Creates a shallow copy of an object with specified keys removed. `, params: { object: { schema: { type: 'any' }, }, keys: { schema: { type: 'array', items: { type: 'string' }, }, attributes: { keyof: 'object', }, } }, result: { schema: { type: 'object', properties: {}, additionalProperties: { type: 'any' }, }, }, }; export const compute = params => { const { object, keys } = params; const res = { ...object }; for (const key of keys) { delete res[key]; } return res; };