Update vendor/underscore to v1.4.3 and update the Underscore build compatibility.

Former-commit-id: ebcaad4a92848bef3bbf65bb8eb3a0c1553e005c
This commit is contained in:
John-David Dalton
2012-12-05 01:03:10 -08:00
parent af9bf3e852
commit 221b347bd9
4 changed files with 19 additions and 24 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
// Underscore.js 1.4.2
// Underscore.js 1.4.3
// http://underscorejs.org
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore may be freely distributed under the MIT license.
@@ -24,7 +24,6 @@
var push = ArrayProto.push,
slice = ArrayProto.slice,
concat = ArrayProto.concat,
unshift = ArrayProto.unshift,
toString = ObjProto.toString,
hasOwnProperty = ObjProto.hasOwnProperty;
@@ -65,7 +64,7 @@
}
// Current version.
_.VERSION = '1.4.2';
_.VERSION = '1.4.3';
// Collection Functions
// --------------------
@@ -102,6 +101,8 @@
return results;
};
var reduceError = 'Reduce of empty array with no initial value';
// **Reduce** builds up a single result from a list of values, aka `inject`,
// or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
_.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
@@ -119,7 +120,7 @@
memo = iterator.call(context, memo, value, index, list);
}
});
if (!initial) throw new TypeError('Reduce of empty array with no initial value');
if (!initial) throw new TypeError(reduceError);
return memo;
};
@@ -146,7 +147,7 @@
memo = iterator.call(context, memo, obj[index], index, list);
}
});
if (!initial) throw new TypeError('Reduce of empty array with no initial value');
if (!initial) throw new TypeError(reduceError);
return memo;
};
@@ -239,7 +240,7 @@
if (_.isEmpty(attrs)) return [];
return _.filter(obj, function(value) {
for (var key in attrs) {
if (_.has(attrs, key) && attrs[key] !== value[key]) return false;
if (attrs[key] !== value[key]) return false;
}
return true;
});
@@ -336,7 +337,7 @@
// either a string attribute to count by, or a function that returns the
// criterion.
_.countBy = function(obj, value, context) {
return group(obj, value, context, function(result, key, value) {
return group(obj, value, context, function(result, key) {
if (!_.has(result, key)) result[key] = 0;
result[key]++;
});
@@ -961,7 +962,7 @@
// Is a given object a finite number?
_.isFinite = function(obj) {
return isFinite( obj ) && !isNaN( parseFloat(obj) );
return isFinite(obj) && !isNaN(parseFloat(obj));
};
// Is the given value `NaN`? (NaN is the only number which does not equal itself).