Update underscore unit tests.

Former-commit-id: ae00a864c7cb3bff9970289917df681ad5e295d9
This commit is contained in:
John-David Dalton
2012-09-12 08:39:18 -07:00
parent 3f8f96edea
commit d5a8fa0b97
3 changed files with 29 additions and 38 deletions

View File

@@ -416,13 +416,13 @@
_.uniq = _.unique = function(array, isSorted, iterator) {
var initial = iterator ? _.map(array, iterator) : array;
var results = [];
_.reduce(initial, function(memo, value, index) {
if (isSorted ? (_.last(memo) !== value || !memo.length) : !_.include(memo, value)) {
memo.push(value);
var seen = [];
each(initial, function(value, index) {
if (isSorted ? (!index || seen[seen.length - 1] !== value) : !_.include(seen, value)) {
seen.push(value);
results.push(array[index]);
}
return memo;
}, []);
});
return results;
};
@@ -830,8 +830,7 @@
if (result) {
// Deep compare the contents, ignoring non-numeric properties.
while (size--) {
// Ensure commutative equality for sparse arrays.
if (!(result = size in a == size in b && eq(a[size], b[size], aStack, bStack))) break;
if (!(result = eq(a[size], b[size], aStack, bStack))) break;
}
}
} else {