is-plain-object
Advanced tools
Comparing version
'use strict'; | ||
/*! | ||
* isobject <https://github.com/jonschlinkert/isobject> | ||
* | ||
* Copyright (c) 2014-2017, Jon Schlinkert. | ||
* Released under the MIT License. | ||
*/ | ||
function isObject(val) { | ||
return val != null && typeof val === 'object' && Array.isArray(val) === false; | ||
} | ||
/*! | ||
* is-plain-object <https://github.com/jonschlinkert/is-plain-object> | ||
@@ -21,6 +10,4 @@ * | ||
function isObjectObject(o) { | ||
var type = Object.prototype.toString.call(o); | ||
return isObject(o) === true | ||
&& (type === '[object Object]' || type === '[object Null]'); | ||
function isObject(o) { | ||
return Object.prototype.toString.call(o) === '[object Object]'; | ||
} | ||
@@ -31,3 +18,3 @@ | ||
if (isObjectObject(o) === false) return false; | ||
if (isObject(o) === false) return false; | ||
@@ -40,3 +27,3 @@ // If has modified constructor | ||
prot = ctor.prototype; | ||
if (isObjectObject(prot) === false) return false; | ||
if (isObject(prot) === false) return false; | ||
@@ -43,0 +30,0 @@ // If constructor does not have an Object-specific method |
@@ -1,3 +0,3 @@ | ||
declare function isPlainObject(o: any): boolean; | ||
declare function isPlainObject(o: any): asserts o is object; | ||
export default isPlainObject; |
/*! | ||
* isobject <https://github.com/jonschlinkert/isobject> | ||
* | ||
* Copyright (c) 2014-2017, Jon Schlinkert. | ||
* Released under the MIT License. | ||
*/ | ||
function isObject(val) { | ||
return val != null && typeof val === 'object' && Array.isArray(val) === false; | ||
} | ||
/*! | ||
* is-plain-object <https://github.com/jonschlinkert/is-plain-object> | ||
@@ -19,6 +8,4 @@ * | ||
function isObjectObject(o) { | ||
var type = Object.prototype.toString.call(o); | ||
return isObject(o) === true | ||
&& (type === '[object Object]' || type === '[object Null]'); | ||
function isObject(o) { | ||
return Object.prototype.toString.call(o) === '[object Object]'; | ||
} | ||
@@ -29,3 +16,3 @@ | ||
if (isObjectObject(o) === false) return false; | ||
if (isObject(o) === false) return false; | ||
@@ -38,3 +25,3 @@ // If has modified constructor | ||
prot = ctor.prototype; | ||
if (isObjectObject(prot) === false) return false; | ||
if (isObject(prot) === false) return false; | ||
@@ -41,0 +28,0 @@ // If constructor does not have an Object-specific method |
{ | ||
"name": "is-plain-object", | ||
"description": "Returns true if an object was created by the `Object` constructor, or Object.create(null).", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"homepage": "https://github.com/jonschlinkert/is-plain-object", | ||
@@ -38,10 +38,8 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"devDependencies": { | ||
"@rollup/plugin-node-resolve": "^8.1.0", | ||
"chai": "^4.2.0", | ||
"esm": "^3.2.22", | ||
"gulp-format-md": "^1.0.0", | ||
"isobject": "^4.0.0", | ||
"mocha": "^6.1.4", | ||
"mocha-headless-chrome": "^3.1.0", | ||
"rollup": "^2.18.1" | ||
"rollup": "^2.22.1" | ||
}, | ||
@@ -48,0 +46,0 @@ "keywords": [ |
@@ -23,3 +23,3 @@ # is-plain-object [](https://www.npmjs.com/package/is-plain-object) [](https://npmjs.org/package/is-plain-object) [](https://npmjs.org/package/is-plain-object) [](https://travis-ci.org/jonschlinkert/is-plain-object) | ||
**true** when created by the `Object` constructor. | ||
**true** when created by the `Object` constructor, or Object.create(null). | ||
@@ -35,2 +35,4 @@ ```js | ||
//=> true | ||
isPlainObject(null); | ||
//=> true | ||
``` | ||
@@ -49,4 +51,2 @@ | ||
//=> false | ||
isPlainObject(null); | ||
//=> false | ||
isPlainObject(Object.create(null)); | ||
@@ -53,0 +53,0 @@ //=> false |
6
-25%8848
-7.7%55
-28.57%