mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-13 04:17:49 +00:00
Issue #202 ... fallback method for sparse arrays.
This commit is contained in:
@@ -26,10 +26,6 @@ $(document).ready(function() {
|
||||
_.each([1, 2, 3], function(num, index, arr){ if (_.include(arr, num)) answer = true; });
|
||||
ok(answer, 'can reference the original collection from inside the iterator');
|
||||
|
||||
answers = [];
|
||||
_.each({range : 1, speed : 2, length : 3}, function(v){ answers.push(v); });
|
||||
ok(answers.join(', '), '1, 2, 3', 'can iterate over objects with numeric length properties');
|
||||
|
||||
answers = 0;
|
||||
_.each(null, function(){ ++answers; });
|
||||
equals(answers, 0, 'handles a null properly');
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
obj.forEach(iterator, context);
|
||||
} else if (_.isNumber(obj.length)) {
|
||||
for (var i = 0, l = obj.length; i < l; i++) {
|
||||
if (iterator.call(context, obj[i], i, obj) === breaker) return;
|
||||
if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return;
|
||||
}
|
||||
} else {
|
||||
for (var key in obj) {
|
||||
@@ -512,7 +512,7 @@
|
||||
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];
|
||||
|
||||
Reference in New Issue
Block a user