UNPKG

@chainsafe/eth2.0-utils

Version:

Utilities required across multiple lodestar packages

32 lines (23 loc) 847 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isPlainObject = isPlainObject; /** * @module objects */ function isObjectObject(val) { return val != null && typeof val === "object" && Array.isArray(val) === false; } // eslint-disable-next-line @typescript-eslint/no-explicit-any function isPlainObject(o) { if (isObjectObject(o) === false) return false; // If has modified constructor const ctor = o.constructor; if (typeof ctor !== "function") return false; // If has modified prototype const prot = ctor.prototype; if (isObjectObject(prot) === false) return false; // If constructor does not have an Object-specific method if (prot.hasOwnProperty("isPrototypeOf") === false) { return false; } // Most likely a plain Object return true; } //# sourceMappingURL=objects.js.map