@amxdev/is-empty
Version:
Utility to check if a value is empty (null, undefined, string, array, or object)
16 lines (15 loc) • 403 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.isEmpty = isEmpty;
// src/index.ts
function isEmpty(value) {
if (value == null)
return true;
if (typeof value === "string" || Array.isArray(value)) {
return value.length === 0;
}
if (typeof value === "object") {
return Object.keys(value).length === 0;
}
return false;
}
;