payload-is
Version:
A comprehensive TypeScript/JavaScript type checking library providing functions to check data types, collections, primitives, and built-in objects
26 lines (23 loc) • 763 B
JavaScript
;
function isObject(payload) {
return typeof payload === "object" && payload !== null;
}
function isPlainObject(payload) {
if (!isObject(payload)) {
return false;
}
const _ctor = payload.constructor;
const _proto = Object.getPrototypeOf(payload);
return _ctor === void 0 && _proto === null || _ctor === Object && _proto === Object.prototype;
}
function isEmptyObject(payload) {
return isPlainObject(payload) && Object.keys(payload).length === 0;
}
function isFullObject(payload) {
return isPlainObject(payload) && Object.keys(payload).length > 0;
}
exports.isEmptyObject = isEmptyObject;
exports.isFullObject = isFullObject;
exports.isObject = isObject;
exports.isPlainObject = isPlainObject;
//# sourceMappingURL=object.cjs.map