Add is.any() and is.all() methods

This commit is contained in:
Kodie Grantham 2017-10-06 12:03:30 -05:00
parent 6268253ec6
commit ce367d3284
3 changed files with 159 additions and 0 deletions

18
test.js
View file

@ -402,3 +402,21 @@ test('is.empty', t => {
tempSet.add(1);
t.false(m.empty(tempSet));
});
test('is.any', t => {
t.true(m.any([null, false], ['null', 'object']));
t.true(m.any(['🦄', []], ['array', 'boolean']));
t.true(m.any([{}, []], ['object', 'string']));
t.false(m.any([null, []], ['string', 'set']));
t.false(m.any([new Set(), true], ['map', 'string']));
t.false(m.any(['🦄', null], ['set', 'boolean']));
});
test('is.all', t => {
t.true(m.all([() => {}, {}], ['object']));
t.true(m.all(['🦄', 'unicorns'], ['string']));
t.true(m.any([new Set()], ['object', 'set']));
t.false(m.any([null, []], ['string', 'set']));
t.false(m.any([new Set(), true], ['map', 'string']));
t.false(m.any(['🦄', null], ['set', 'boolean']));
});