Realign _.assign and _.defaults with ES6 Object.assign. [closes #259]

Former-commit-id: e8c89e4a130ed286ce07e1a2e848f50b182effae
This commit is contained in:
John-David Dalton
2013-05-03 08:33:51 -07:00
parent 9ae24141a3
commit bdac8974d8
2 changed files with 13 additions and 10 deletions

View File

@@ -585,6 +585,7 @@
'while (++argsIndex < argsLength) {\n' + 'while (++argsIndex < argsLength) {\n' +
' iterable = args[argsIndex];\n' + ' iterable = args[argsIndex];\n' +
' if (iterable && objectTypes[typeof iterable]) {', ' if (iterable && objectTypes[typeof iterable]) {',
'arrays': false,
'loop': "if (typeof result[index] == 'undefined') result[index] = iterable[index]", 'loop': "if (typeof result[index] == 'undefined') result[index] = iterable[index]",
'bottom': ' }\n}' 'bottom': ' }\n}'
}; };

View File

@@ -706,19 +706,21 @@
deepEqual(func({}, new Foo), {}); deepEqual(func({}, new Foo), {});
}); });
test('lodash.' + methodName + ' should treat sparse arrays as dense', function() { if (methodName == 'merge') {
var array = Array(3); test('lodash.' + methodName + ' should treat sparse arrays as dense', function() {
array[0] = 1; var array = Array(3);
array[2] = 3; array[0] = 1;
array[2] = 3;
var actual = func([], array), var actual = func([], array),
expected = array.slice(); expected = array.slice();
expected[1] = undefined; expected[1] = undefined;
ok(1 in actual); ok(1 in actual);
deepEqual(actual, expected); deepEqual(actual, expected);
}); });
}
}); });
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/