vendor/assets/javascripts/underscore.js in rails-backbone-0.2.0 vs vendor/assets/javascripts/underscore.js in rails-backbone-0.5.0
- old
+ new
@@ -53,12 +53,11 @@
// global object.
if (typeof module !== 'undefined' && module.exports) {
module.exports = _;
_._ = _;
} else {
- // Exported as a string, for Closure Compiler "advanced" mode.
- root['_'] = _;
+ root._ = _;
}
// Current version.
_.VERSION = '1.1.6';
@@ -72,11 +71,11 @@
if (obj == null) return;
if (nativeForEach && obj.forEach === nativeForEach) {
obj.forEach(iterator, context);
} else if (_.isNumber(obj.length)) {
for (var i = 0, l = obj.length; i < l; i++) {
- if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return;
+ if (iterator.call(context, obj[i], i, obj) === breaker) return;
}
} else {
for (var key in obj) {
if (hasOwnProperty.call(obj, key)) {
if (iterator.call(context, obj[key], key, obj) === breaker) return;
@@ -250,20 +249,10 @@
var a = left.criteria, b = right.criteria;
return a < b ? -1 : a > b ? 1 : 0;
}), 'value');
};
- // Groups the object's values by a criterion produced by an iterator
- _.groupBy = function(obj, iterator) {
- var result = {};
- each(obj, function(value, index) {
- var key = iterator(value, index);
- (result[key] || (result[key] = [])).push(value);
- });
- return result;
- };
-
// Use a comparator function to figure out at what index an object should
// be inserted so as to maintain order. Uses binary search.
_.sortedIndex = function(array, obj, iterator) {
iterator || (iterator = _.identity);
var low = 0, high = array.length;
@@ -511,10 +500,10 @@
// consuming the return value of the function that follows.
_.compose = function() {
var funcs = slice.call(arguments);
return function() {
var args = slice.call(arguments);
- for (var i = funcs.length - 1; i >= 0; i--) {
+ for (var i=funcs.length-1; i >= 0; i--) {
args = [funcs[i].apply(this, args)];
}
return args[0];
};
};