Update vendor/underscore.

Former-commit-id: 3d39397aaee8408778b738c3aa105eda67abd6bc
This commit is contained in:
John-David Dalton
2012-11-06 22:00:01 -08:00
parent 23a0507439
commit ed48603ab5
3 changed files with 10 additions and 5 deletions

View File

@@ -213,13 +213,11 @@
// Determine if the array or object contains a given value (using `===`).
// Aliased as `include`.
_.contains = _.include = function(obj, target) {
var found = false;
if (obj == null) return found;
if (obj == null) return false;
if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
found = any(obj, function(value) {
return any(obj, function(value) {
return value === target;
});
return found;
};
// Invoke a method (with arguments) on every item in a collection.
@@ -439,6 +437,11 @@
// been sorted, you have the option of using a faster algorithm.
// Aliased as `unique`.
_.uniq = _.unique = function(array, isSorted, iterator, context) {
if (_.isFunction(isSorted)) {
context = iterator;
iterator = isSorted;
isSorted = false;
}
var initial = iterator ? _.map(array, iterator, context) : array;
var results = [];
var seen = [];