mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Ensure _.isPlainObject returns false for objects without a [[Class]] of "Object".
Former-commit-id: ce034f55733cd1929f09bf80e4a461c6e1502d1b
This commit is contained in:
6
dist/lodash.compat.js
vendored
6
dist/lodash.compat.js
vendored
@@ -1005,7 +1005,7 @@
|
||||
function shimIsPlainObject(value) {
|
||||
// avoid non-objects and false positives for `arguments` objects
|
||||
var result = false;
|
||||
if (!(value && typeof value == 'object') || isArguments(value)) {
|
||||
if (!(value && toString.call(value) == objectClass) || (!support.argsClass && isArguments(value))) {
|
||||
return result;
|
||||
}
|
||||
// check that the constructor is `Object` (i.e. `Object instanceof Object`)
|
||||
@@ -1838,14 +1838,14 @@
|
||||
* // => true
|
||||
*/
|
||||
var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) {
|
||||
if (!(value && typeof value == 'object')) {
|
||||
if (!(value && toString.call(value) == objectClass) || (!support.argsClass && isArguments(value))) {
|
||||
return false;
|
||||
}
|
||||
var valueOf = value.valueOf,
|
||||
objProto = typeof valueOf == 'function' && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto);
|
||||
|
||||
return objProto
|
||||
? value == objProto || (getPrototypeOf(value) == objProto && !isArguments(value))
|
||||
? (value == objProto || getPrototypeOf(value) == objProto)
|
||||
: shimIsPlainObject(value);
|
||||
};
|
||||
|
||||
|
||||
6
dist/lodash.js
vendored
6
dist/lodash.js
vendored
@@ -841,7 +841,7 @@
|
||||
function shimIsPlainObject(value) {
|
||||
// avoid non-objects and false positives for `arguments` objects
|
||||
var result = false;
|
||||
if (!(value && typeof value == 'object') || isArguments(value)) {
|
||||
if (!(value && toString.call(value) == objectClass)) {
|
||||
return result;
|
||||
}
|
||||
// check that the constructor is `Object` (i.e. `Object instanceof Object`)
|
||||
@@ -1657,14 +1657,14 @@
|
||||
* // => true
|
||||
*/
|
||||
var isPlainObject = function(value) {
|
||||
if (!(value && typeof value == 'object')) {
|
||||
if (!(value && toString.call(value) == objectClass)) {
|
||||
return false;
|
||||
}
|
||||
var valueOf = value.valueOf,
|
||||
objProto = typeof valueOf == 'function' && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto);
|
||||
|
||||
return objProto
|
||||
? value == objProto || (getPrototypeOf(value) == objProto && !isArguments(value))
|
||||
? (value == objProto || getPrototypeOf(value) == objProto)
|
||||
: shimIsPlainObject(value);
|
||||
};
|
||||
|
||||
|
||||
2
dist/lodash.underscore.js
vendored
2
dist/lodash.underscore.js
vendored
@@ -656,7 +656,7 @@
|
||||
function shimIsPlainObject(value) {
|
||||
// avoid non-objects and false positives for `arguments` objects
|
||||
var result = false;
|
||||
if (!(value && typeof value == 'object') || isArguments(value)) {
|
||||
if (!(value && toString.call(value) == objectClass)) {
|
||||
return result;
|
||||
}
|
||||
// check that the constructor is `Object` (i.e. `Object instanceof Object`)
|
||||
|
||||
Reference in New Issue
Block a user