Cleanup _.difference, _.intersecton, _.without.

Former-commit-id: 1ca8edb52a1c403fc2d8a8e1b3fd113ced9ff39e
This commit is contained in:
John-David Dalton
2012-10-02 01:43:21 -07:00
parent 5167bbf59e
commit 126804f7c3
3 changed files with 54 additions and 53 deletions

View File

@@ -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;