Cleanup fix for modularize underscore and _.mixin and add tests for correct indicatorObject use in underscore builds.

Former-commit-id: 7700fb4df90cdc3eca47af037677d71a70908616
This commit is contained in:
John-David Dalton
2013-08-06 09:07:45 -07:00
parent 3c626e3ea5
commit fff5ae97f2
10 changed files with 317 additions and 279 deletions

View File

@@ -1896,7 +1896,7 @@
}
} else {
forOwn(collection, callback);
};
}
}
/**
@@ -1916,7 +1916,7 @@
* _([1, 2, 3]).forEachRight(function(num) { console.log(num); }).join(',');
* // => logs each number from right to left and returns '3,2,1'
*/
function forEachRight(collection, callback, thisArg) {
function forEachRight(collection, callback) {
var iterable = collection,
length = collection ? collection.length : 0;
@@ -1924,12 +1924,10 @@
var props = keys(collection);
length = props.length;
}
callback = baseCreateCallback(callback, thisArg, 3);
forEach(collection, function(value, index, collection) {
index = props ? props[--length] : --length;
callback(iterable[index], index, collection);
return callback(iterable[index], index, collection) === false && indicatorObject;
});
return collection;
}
/**
@@ -4145,7 +4143,9 @@
* ');
*/
function template(text, data, options) {
var settings = lodash.templateSettings;
var _ = lodash,
settings = _.templateSettings;
text || (text = '');
options = defaults({}, options, settings);
@@ -4186,7 +4186,7 @@
'return __p\n}';
try {
var result = Function('_', 'return ' + source)(lodash);
var result = Function('_', 'return ' + source)(_);
} catch(e) {
e.source = source;
throw e;