Add is.even() and is.odd() (#23)

This commit is contained in:
Brandon Smith 2017-10-17 11:36:10 -04:00 committed by Sindre Sorhus
parent 00974a2fe9
commit 615932d6c2
3 changed files with 32 additions and 0 deletions

20
test.js
View file

@ -419,6 +419,26 @@ test('is.infinite', t => {
testType(t, 'infinite', ['number']);
});
test('is.even', t => {
for (const el of [-6, 2, 4]) {
t.true(m.even(el));
}
for (const el of [-3, 1, 5]) {
t.false(m.even(el));
}
});
test('is.odd', t => {
for (const el of [-5, 7, 13]) {
t.true(m.odd(el));
}
for (const el of [-8, 8, 10]) {
t.false(m.odd(el));
}
});
test('is.empty', t => {
t.true(m.empty(null));
t.true(m.empty(undefined));