isnullorempty
Version:
Check if a given object is null or empty
33 lines (26 loc) • 667 B
JavaScript
function isNull(value) {
return value === null;
}
function isUndefined(value) {
return value === undefined;
}
function isEmpty(value) {
for(var entry in value) {
if(entry != undefined)
return false;
}
return true;
}
function isNullOrUndefined(value) {
return value == null;
}
function isNullOrEmpty(value) {
return (isNullOrUndefined(value) || isEmpty(value));
}
module.exports = isNullOrEmpty;
module.exports.isNull = isNull;
module.exports.isEmpty = isEmpty;
module.exports.isUndefined = isUndefined;
module.exports.isNullOrEmpty = isNullOrEmpty;
module.exports.isNullOrUndefined = isNullOrUndefined;
;