mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Ensure _.pullAll works with the same value for array and values. [closes #2356]
This commit is contained in:
@@ -3394,6 +3394,9 @@
|
|||||||
length = values.length,
|
length = values.length,
|
||||||
seen = array;
|
seen = array;
|
||||||
|
|
||||||
|
if (array === values) {
|
||||||
|
values = copyArray(values);
|
||||||
|
}
|
||||||
if (iteratee) {
|
if (iteratee) {
|
||||||
seen = arrayMap(array, baseUnary(iteratee));
|
seen = arrayMap(array, baseUnary(iteratee));
|
||||||
}
|
}
|
||||||
|
|||||||
15
test/test.js
15
test/test.js
@@ -18081,6 +18081,21 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('lodash.pullAll');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
QUnit.test('should work with the same value for `array` and `values`', function(assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
|
||||||
|
var array = [{ 'a': 1 }, { 'b': 2 }],
|
||||||
|
actual = _.pullAll(array, array);
|
||||||
|
|
||||||
|
assert.deepEqual(actual, []);
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('lodash.pullAllBy');
|
QUnit.module('lodash.pullAllBy');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user