Add is.empty()
This commit is contained in:
parent
ee8f5d16f8
commit
af2ad0c819
3 changed files with 36 additions and 0 deletions
23
test.js
23
test.js
|
|
@ -373,3 +373,26 @@ test('is.inRange', t => {
|
|||
test('is.infinite', t => {
|
||||
testType(t, 'infinite', ['number']);
|
||||
});
|
||||
|
||||
test('is.empty', t => {
|
||||
t.true(m.empty(''));
|
||||
t.false(m.empty('🦄'));
|
||||
|
||||
t.true(m.empty([]));
|
||||
t.false(m.empty(['🦄']));
|
||||
|
||||
t.true(m.empty({}));
|
||||
t.false(m.empty({unicorn: '🦄'}));
|
||||
|
||||
const tempMap = new Map();
|
||||
t.true(m.empty(tempMap));
|
||||
|
||||
tempMap.set('unicorn', '🦄');
|
||||
t.false(m.empty(tempMap));
|
||||
|
||||
const tempSet = new Set();
|
||||
t.true(m.empty(tempSet));
|
||||
|
||||
tempSet.add(1);
|
||||
t.false(m.empty(tempSet));
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue