tiny-types
Version:
A tiny library that brings Tiny Types to JavaScript and TypeScript
24 lines • 753 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isRecord = isRecord;
const isObject_1 = require("./isObject");
function isRecord(value) {
if (!(0, isObject_1.isObject)(value)) {
return false;
}
// It has modified constructor
if (value.constructor === undefined) {
return true;
}
// It has modified prototype
if (!(0, isObject_1.isObject)(value.constructor.prototype)) {
return false;
}
// If constructor does not have an Object-specific method
if (!Object.prototype.hasOwnProperty.call(value.constructor.prototype, 'isPrototypeOf')) {
return false;
}
// Most likely a plain Object
return true;
}
//# sourceMappingURL=isRecord.js.map