Ensure _.merge works with _.reduce.

Former-commit-id: de53bfd024c7a088c98ee94c95d0c57fb00ed032
This commit is contained in:
John-David Dalton
2012-11-12 07:35:05 -08:00
parent 6f258000fe
commit d29b8eca3c
3 changed files with 42 additions and 34 deletions

View File

@@ -1157,6 +1157,14 @@
var expected = { 'a': 4 };
deepEqual(_.merge({ 'a': 1 }, { 'a': 2 }, { 'a': 3 }, expected), expected);
});
test('should work with `_.reduce`', function() {
var actual = { 'a': 1},
array = [{ 'b': 2 }, { 'c': 3 }];
_.reduce(array, _.merge, actual);
deepEqual(actual, { 'a': 1, 'b': 2, 'c': 3});
});
}(1, 2, 3));
/*--------------------------------------------------------------------------*/