mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Remove noArgsClass check from isPlainObject.
Former-commit-id: bab7a68e8eaa21679b33b2ab70a9f8e47758ebc1
This commit is contained in:
@@ -749,9 +749,9 @@
|
|||||||
* @returns {Boolean} Returns `true` if the `value` is a plain `Object` object, else `false`.
|
* @returns {Boolean} Returns `true` if the `value` is a plain `Object` object, else `false`.
|
||||||
*/
|
*/
|
||||||
function isPlainObject(value) {
|
function isPlainObject(value) {
|
||||||
// avoid non-objects and false positives for `arguments` objects in IE < 9
|
// avoid non-objects and false positives for `arguments` objects
|
||||||
var result = false;
|
var result = false;
|
||||||
if (!(value && typeof value == 'object') || (noArgsClass && isArguments(value))) {
|
if (!(value && typeof value == 'object') || isArguments(value)) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
// IE < 9 presents DOM nodes as `Object` objects except they have `toString`
|
// IE < 9 presents DOM nodes as `Object` objects except they have `toString`
|
||||||
|
|||||||
19
test/test.js
19
test/test.js
@@ -859,6 +859,8 @@
|
|||||||
QUnit.module('lodash.merge');
|
QUnit.module('lodash.merge');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
var args = arguments;
|
||||||
|
|
||||||
test('should merge `source` into the destination object', function() {
|
test('should merge `source` into the destination object', function() {
|
||||||
var stooges = [
|
var stooges = [
|
||||||
{ 'name': 'moe' },
|
{ 'name': 'moe' },
|
||||||
@@ -918,7 +920,20 @@
|
|||||||
|
|
||||||
deepEqual(_.merge(object, source), [shadowed]);
|
deepEqual(_.merge(object, source), [shadowed]);
|
||||||
});
|
});
|
||||||
}());
|
|
||||||
|
test('should not treat `arguments` objects as plain objects', function() {
|
||||||
|
var object = {
|
||||||
|
'args': args
|
||||||
|
};
|
||||||
|
|
||||||
|
var source = {
|
||||||
|
'args': { '3': 4 }
|
||||||
|
};
|
||||||
|
|
||||||
|
var actual = _.merge(object, source);
|
||||||
|
equal(_.isArguments(actual.args), false);
|
||||||
|
});
|
||||||
|
}(1, 2, 3));
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@@ -1112,7 +1127,7 @@
|
|||||||
QUnit.module('lodash.sortBy');
|
QUnit.module('lodash.sortBy');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
test('should perform a stable sort', function() {
|
test('should perform a stable sort (test in IE > 8, Opera, and V8)', function() {
|
||||||
function Pair(x, y) {
|
function Pair(x, y) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
|
|||||||
Reference in New Issue
Block a user