UNPKG

@nodescript/stdlib

Version:
31 lines (30 loc) 686 B
export const module = { version: '1.2.5', moduleName: 'Object / Remove Undefined', description: ` Removes undefined values from the object. `, params: { object: { schema: { type: 'any' }, hideValue: true, }, }, result: { schema: { type: 'object', properties: {}, additionalProperties: { type: 'any' }, }, }, }; export const compute = params => { const { object } = params; const res = {}; for (const [key, value] of Object.entries(object)) { if (value !== undefined) { res[key] = value; } } return res; };