typedash
Version:
modern, type-safe collection of utility functions
25 lines (23 loc) • 762 B
JavaScript
const require_isArray = require('./isArray-CK0opY_i.cjs');
//#region src/functions/isEmpty/isEmpty.ts
/**
* Implementation for all overloads.
* @param value The value to check.
* @returns Whether the input value is empty.
*/
function isEmpty(value) {
if (value == null) return true;
if (require_isArray.isArray(value) || typeof value === "string") return value.length === 0;
if (value instanceof Map || value instanceof Set) return value.size === 0;
if (typeof value === "number") return !value;
if (typeof value === "object") return Object.keys(value).length === 0;
return false;
}
//#endregion
Object.defineProperty(exports, 'isEmpty', {
enumerable: true,
get: function () {
return isEmpty;
}
});
//# sourceMappingURL=isEmpty-Q-g73dbK.cjs.map