You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
721 B
23 lines
721 B
import isObjectLike from './is-object-like';
|
|
import isType from './is-type';
|
|
var isPlainObject = function (value) {
|
|
/**
|
|
* isObjectLike(new Foo) => false
|
|
* isObjectLike([1, 2, 3]) => false
|
|
* isObjectLike({ x: 0, y: 0 }) => true
|
|
* isObjectLike(Object.create(null)) => true
|
|
*/
|
|
if (!isObjectLike(value) || !isType(value, 'Object')) {
|
|
return false;
|
|
}
|
|
if (Object.getPrototypeOf(value) === null) {
|
|
return true;
|
|
}
|
|
var proto = value;
|
|
while (Object.getPrototypeOf(proto) !== null) {
|
|
proto = Object.getPrototypeOf(proto);
|
|
}
|
|
return Object.getPrototypeOf(value) === proto;
|
|
};
|
|
export default isPlainObject;
|
|
//# sourceMappingURL=is-plain-object.js.map
|