UNPKG

@nodescript/stdlib

Version:
24 lines (23 loc) 625 B
export const module = { version: '1.1.4', moduleName: 'Logic / Is Empty', description: ` Returns true if the specified value is empty. Empty values are: null, undefined, NaN, empty string or an array with 0 length. `, params: { value: { schema: { type: 'any' }, }, }, result: { schema: { type: 'boolean' }, } }; export const compute = params => { const { value } = params; return (typeof value === 'number' && isNaN(value)) || value == null || value === '' || (Array.isArray(value) && value.length === 0); };