mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Allow lodash underscore plus=cloneDeep without also needing to include clone.
Former-commit-id: 90f89296ab47eff635c3c30ed34466e347ea13d3
This commit is contained in:
2
build.js
2
build.js
@@ -1708,7 +1708,7 @@
|
|||||||
exposeZipObject = methods.indexOf('zipObject') > -1;
|
exposeZipObject = methods.indexOf('zipObject') > -1;
|
||||||
|
|
||||||
methods = _.without.apply(_, [plusMethods].concat(minusMethods));
|
methods = _.without.apply(_, [plusMethods].concat(minusMethods));
|
||||||
useUnderscoreClone = methods.indexOf('clone') < 0;
|
useUnderscoreClone = methods.indexOf('clone') < 0 && methods.indexOf('cloneDeep') < 0;
|
||||||
}
|
}
|
||||||
// update dependencies
|
// update dependencies
|
||||||
if (isLegacy) {
|
if (isLegacy) {
|
||||||
|
|||||||
@@ -994,21 +994,34 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest('`lodash underscore plus=clone`', function() {
|
var commands = [
|
||||||
var start = _.after(2, _.once(QUnit.start));
|
'plus=clone',
|
||||||
|
'plus=cloneDeep'
|
||||||
|
];
|
||||||
|
|
||||||
build(['-s', 'underscore', 'plus=clone'], function(data) {
|
commands.forEach(function(command, index) {
|
||||||
var array = [{ 'value': 1 }],
|
asyncTest('`lodash ' + command +'`', function() {
|
||||||
basename = path.basename(data.outputPath, '.js'),
|
var start = _.after(2, _.once(QUnit.start));
|
||||||
context = createContext();
|
|
||||||
|
|
||||||
vm.runInContext(data.source, context);
|
build(['-s', 'underscore', command], function(data) {
|
||||||
var lodash = context._,
|
var array = [{ 'value': 1 }],
|
||||||
clone = lodash.clone(array, true);
|
basename = path.basename(data.outputPath, '.js'),
|
||||||
|
context = createContext();
|
||||||
|
|
||||||
ok(_.isEqual(array, clone), basename);
|
vm.runInContext(data.source, context, true);
|
||||||
notEqual(array[0], clone[0], basename);
|
var lodash = context._;
|
||||||
start();
|
|
||||||
|
_.each(index ? ['clone','cloneDeep'] : ['clone'], function(methodName) {
|
||||||
|
var clone = (methodName == 'clone')
|
||||||
|
? lodash.clone(array, true)
|
||||||
|
: lodash.cloneDeep(array);
|
||||||
|
|
||||||
|
ok(_.isEqual(array, clone), basename);
|
||||||
|
notEqual(array[0], clone[0], basename);
|
||||||
|
});
|
||||||
|
|
||||||
|
start();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|||||||
Reference in New Issue
Block a user