Files
automatisch/packages/web/src/helpers/isEmpty.ts
2023-06-12 14:06:13 +02:00

17 lines
379 B
TypeScript

import lodashIsEmpty from 'lodash/isEmpty';
export default function isEmpty(value: any) {
if (value === undefined && value === null) return true;
if (Array.isArray(value) || typeof value === 'string') {
return value.length === 0;
}
if (!Number.isNaN(value)) {
return false;
}
// covers objects and anything else possibly
return lodashIsEmpty(value);
};