trello-for-wolves
Version:
Node.js wrapper for Trello API...for wolves.
23 lines (22 loc) • 680 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isEmpty = void 0;
/**
* Returns true if the specified value is null, undefined, an empty object or
* an empty array.
*/
function isEmpty(value) {
if (typeof value === "undefined" || value === null) {
return true;
}
if (Array.isArray(value)) {
return value.length === 0;
}
if (typeof value === "object") {
return Object.keys(value).length === 0;
}
// The value is a number, string, or boolean. We don't want to return
// true if the falsy condition is met because it's still a valid value:
return false;
}
exports.isEmpty = isEmpty;