第三方包_is plain object - dkvirus/npm-resource-read GitHub Wiki

说明

判断变量是否是纯对象。恕我直言,这个库就是鸡肋。第三方库,使用前先安装 $ npm install is-plain-object

示例

isPlainObject(Object.create({}));
//=> true
isPlainObject(Object.create(Object.prototype));
//=> true
isPlainObject({foo: 'bar'});
//=> true
isPlainObject({});
//=> true


isPlainObject(1);
//=> false
isPlainObject(['foo', 'bar']);
//=> false
isPlainObject([]);
//=> false
isPlainObject(new Foo);
//=> false
isPlainObject(null);
//=> false
isPlainObject(Object.create(null));
//=> false