fixed any() for strings on IE8

This commit is contained in:
Jeff McGee
2011-11-03 18:47:07 -05:00
parent 0535545038
commit aedab9c7dd
2 changed files with 3 additions and 1 deletions

View File

@@ -140,6 +140,8 @@ $(document).ready(function() {
ok(!_.any([]), 'the empty set');
ok(!_.any([false, false, false]), 'all false values');
ok(_.any([false, false, true]), 'one true value');
ok(_.any([null, 0, 'yes', false]), 'a string');
ok(!_.any([null, 0, '', false]), 'falsy values');
ok(!_.any([1, 11, 29], function(num){ return num % 2 == 0; }), 'all odd numbers');
ok(_.any([1, 10, 29], function(num){ return num % 2 == 0; }), 'an even number');
ok(_.some([false, false, true]), 'aliased as "some"');

View File

@@ -194,7 +194,7 @@
if (obj == null) return result;
if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context);
each(obj, function(value, index, list) {
if (result |= iterator.call(context, value, index, list)) return breaker;
if (result = result||iterator.call(context, value, index, list)) return breaker;
});
return !!result;
};