mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Cleanup _.difference, _.intersecton, _.without.
Former-commit-id: 1ca8edb52a1c403fc2d8a8e1b3fd113ced9ff39e
This commit is contained in:
15
lodash.js
15
lodash.js
@@ -2446,8 +2446,9 @@
|
||||
result = [];
|
||||
|
||||
while (++index < length) {
|
||||
if (!contains(array[index])) {
|
||||
result.push(array[index]);
|
||||
var value = array[index];
|
||||
if (!contains(value)) {
|
||||
result.push(value);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -2594,15 +2595,14 @@
|
||||
* // => [1, 2]
|
||||
*/
|
||||
function intersection(array) {
|
||||
var value,
|
||||
argsLength = arguments.length,
|
||||
var argsLength = arguments.length,
|
||||
cache = [],
|
||||
index = -1,
|
||||
length = array.length,
|
||||
result = [];
|
||||
|
||||
array: while (++index < length) {
|
||||
value = array[index];
|
||||
var value = array[index];
|
||||
if (indexOf(result, value) < 0) {
|
||||
for (var argsIndex = 1; argsIndex < argsLength; argsIndex++) {
|
||||
if (!(cache[argsIndex] || (cache[argsIndex] = cachedContains(arguments[argsIndex])))(value)) {
|
||||
@@ -3042,8 +3042,9 @@
|
||||
result = [];
|
||||
|
||||
while (++index < length) {
|
||||
if (!contains(array[index])) {
|
||||
result.push(array[index]);
|
||||
var value = array[index];
|
||||
if (!contains(value)) {
|
||||
result.push(value);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user