mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 01:17:50 +00:00
added an _.zip()
This commit is contained in:
@@ -16,22 +16,6 @@ $(document).ready(function() {
|
||||
equals(answers.join(', '), '5, 10, 15', 'context object property accessed');
|
||||
});
|
||||
|
||||
test('collections: all', function() {
|
||||
ok(_.all([]), 'the empty set');
|
||||
ok(_.all([true, true, true]), 'all true values');
|
||||
ok(!_.all([true, false, true]), 'one false value');
|
||||
ok(_.all([0, 10, 28], function(num){ return num % 2 == 0; }), 'even numbers');
|
||||
ok(!_.all([0, 11, 28], function(num){ return num % 2 == 0; }), 'an odd number');
|
||||
});
|
||||
|
||||
test('collections: any', function() {
|
||||
ok(!_.any([]), 'the empty set');
|
||||
ok(!_.any([false, false, false]), 'all false values');
|
||||
ok(_.any([false, false, true]), 'one true value');
|
||||
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');
|
||||
});
|
||||
|
||||
test('collections: map', function() {
|
||||
var doubled = _.map([1, 2, 3], function(num){ return num * 2; });
|
||||
equals(doubled.join(', '), '2, 4, 6', 'doubled numbers');
|
||||
@@ -60,6 +44,22 @@ $(document).ready(function() {
|
||||
equals(odds.join(', '), '1, 3, 5', 'rejected each even number');
|
||||
});
|
||||
|
||||
test('collections: all', function() {
|
||||
ok(_.all([]), 'the empty set');
|
||||
ok(_.all([true, true, true]), 'all true values');
|
||||
ok(!_.all([true, false, true]), 'one false value');
|
||||
ok(_.all([0, 10, 28], function(num){ return num % 2 == 0; }), 'even numbers');
|
||||
ok(!_.all([0, 11, 28], function(num){ return num % 2 == 0; }), 'an odd number');
|
||||
});
|
||||
|
||||
test('collections: any', function() {
|
||||
ok(!_.any([]), 'the empty set');
|
||||
ok(!_.any([false, false, false]), 'all false values');
|
||||
ok(_.any([false, false, true]), 'one true value');
|
||||
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');
|
||||
});
|
||||
|
||||
test('collections: include', function() {
|
||||
ok(_.include([1,2,3], 2), 'two is in the array');
|
||||
ok(!_.include([1,3,9], 2), 'two is not in the array');
|
||||
|
||||
Reference in New Issue
Block a user