typedash
Version:
modern, type-safe collection of utility functions
20 lines (18 loc) • 652 B
JavaScript
import { t as isArray } from "./isArray-DkX32HVI.js";
//#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 (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
export { isEmpty as t };
//# sourceMappingURL=isEmpty-D4PMtByw.js.map