mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Add fp.assignAllWith, fp.extendAllWith, and fp.mergeAllWith.
This commit is contained in:
@@ -414,7 +414,7 @@
|
||||
'wrap'
|
||||
];
|
||||
|
||||
var exceptions = _.difference(funcMethods.concat('matchesProperty'), ['cloneDeepWith', 'cloneWith', 'delay']),
|
||||
var exceptions = _.without(funcMethods.concat('matchesProperty'), 'delay'),
|
||||
expected = _.map(mapping.aryMethod[2], _.constant(true));
|
||||
|
||||
var actual = _.map(mapping.aryMethod[2], function(methodName) {
|
||||
@@ -775,6 +775,35 @@
|
||||
});
|
||||
});
|
||||
|
||||
_.each(['assignAllWith', 'assignInAllWith', 'extendAllWith'], function(methodName) {
|
||||
var func = fp[methodName];
|
||||
|
||||
QUnit.test('`fp.' + methodName + '` should provide the correct `customizer` arguments', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var args;
|
||||
|
||||
func(function() {
|
||||
args || (args = _.map(arguments, _.cloneDeep));
|
||||
})([{ 'a': 1 }, { 'b': 2 }]);
|
||||
|
||||
assert.deepEqual(args, [undefined, 2, 'b', { 'a': 1 }, { 'b': 2 }]);
|
||||
});
|
||||
|
||||
QUnit.test('`fp.' + methodName + '` should not mutate values', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var objects = [{ 'a': 1 }, { 'b': 2 }];
|
||||
|
||||
var actual = func(function(objValue, srcValue) {
|
||||
return srcValue;
|
||||
})(objects);
|
||||
|
||||
assert.deepEqual(objects[0], { 'a': 1 });
|
||||
assert.deepEqual(actual, { 'a': 1, 'b': 2 });
|
||||
});
|
||||
});
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('fp.castArray');
|
||||
|
||||
Reference in New Issue
Block a user