Comparing version 1.10.0 to 1.10.1
@@ -9,8 +9,8 @@ var getType = function (payload) { | ||
export var isPlainObject = function (payload) { | ||
if (getType(payload) !== 'Object') | ||
if (typeof payload !== 'object' || payload === null) | ||
return false; | ||
if (payload === Object.prototype) | ||
return false; | ||
if (Object.getPrototypeOf(payload) === null) | ||
return true; | ||
if (payload === Object.prototype) | ||
return false; | ||
return (payload.constructor === Object && | ||
@@ -17,0 +17,0 @@ Object.getPrototypeOf(payload) === Object.prototype); |
@@ -14,8 +14,8 @@ "use strict"; | ||
var isPlainObject = function (payload) { | ||
if (getType(payload) !== 'Object') | ||
if (typeof payload !== 'object' || payload === null) | ||
return false; | ||
if (payload === Object.prototype) | ||
return false; | ||
if (Object.getPrototypeOf(payload) === null) | ||
return true; | ||
if (payload === Object.prototype) | ||
return false; | ||
return (payload.constructor === Object && | ||
@@ -22,0 +22,0 @@ Object.getPrototypeOf(payload) === Object.prototype); |
{ | ||
"version": "1.10.0", | ||
"version": "1.10.1", | ||
"license": "MIT", | ||
@@ -4,0 +4,0 @@ "main": "dist/index.js", |
@@ -36,2 +36,5 @@ import { | ||
expect(isURL(new URL('https://example.com'))).toBe(true); | ||
expect(isPlainObject({})).toBe(true); | ||
// eslint-disable-next-line no-new-object | ||
expect(isPlainObject(new Object())).toBe(true); | ||
}); | ||
@@ -56,2 +59,7 @@ | ||
expect(isURL('https://example.com')).toBe(false); | ||
expect(isPlainObject(null)).toBe(false); | ||
expect(isPlainObject([])).toBe(false); | ||
expect(isPlainObject(Object.prototype)).toBe(false); | ||
expect(isPlainObject(Object.create(Array.prototype))).toBe(false); | ||
}); | ||
@@ -58,0 +66,0 @@ |
@@ -12,5 +12,6 @@ const getType = (payload: any): string => | ||
): payload is { [key: string]: any } => { | ||
if (getType(payload) !== 'Object') return false; | ||
if (typeof payload !== 'object' || payload === null) return false; | ||
if (payload === Object.prototype) return false; | ||
if (Object.getPrototypeOf(payload) === null) return true; | ||
if (payload === Object.prototype) return false; | ||
return ( | ||
@@ -17,0 +18,0 @@ payload.constructor === Object && |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
215268
4294