Add is.propertyKey (#138)
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com> Co-authored-by: Giora Guttsait <giora111@gmail.com>
This commit is contained in:
parent
6f2b24d822
commit
d2f98e472d
3 changed files with 23 additions and 0 deletions
14
test/test.ts
14
test/test.ts
|
|
@ -1490,6 +1490,20 @@ test('is.nonEmptyMap', t => {
|
|||
});
|
||||
});
|
||||
|
||||
test('is.propertyKey', t => {
|
||||
t.true(is.propertyKey('key'));
|
||||
t.true(is.propertyKey(42));
|
||||
t.true(is.propertyKey(Symbol('')));
|
||||
|
||||
t.false(is.propertyKey(null));
|
||||
t.false(is.propertyKey(undefined));
|
||||
t.false(is.propertyKey(true));
|
||||
t.false(is.propertyKey({}));
|
||||
t.false(is.propertyKey([]));
|
||||
t.false(is.propertyKey(new Map()));
|
||||
t.false(is.propertyKey(new Set()));
|
||||
});
|
||||
|
||||
test('is.any', t => {
|
||||
t.true(is.any(is.string, {}, true, '🦄'));
|
||||
t.true(is.any(is.object, false, {}, 'unicorns'));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue