UNPKG

@razorpay/blade

Version:

The Design System that powers Razorpay

39 lines (31 loc) 1.06 kB
import _typeof from '@babel/runtime/helpers/typeof'; /* eslint-disable @typescript-eslint/no-explicit-any */ // eslint-disable-next-line @typescript-eslint/no-explicit-any function isEmpty(value) { // Check if the value is null or undefined if (value == null) { return true; } if (Array.isArray(value)) { return value.length === 0; } // Check if the value is a collection, map, or set and has zero size if (value instanceof Map || value instanceof Set) { return value.size === 0; } // Check if the value is an object and has no own enumerable properties if (_typeof(value) === 'object' && Object.keys(value).length === 0) { return true; } // Check if the value is a string and has zero length if (typeof value === 'string' && value.length === 0) { return true; } // https://github.com/lodash/lodash/issues/496#issuecomment-37692727 if (typeof value === 'number' || typeof value === 'boolean') { return true; } return false; } export { isEmpty as default }; //# sourceMappingURL=isEmpty.js.map