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:
PopGoesTheWza 2021-09-10 10:26:13 +02:00 committed by GitHub
parent 6f2b24d822
commit d2f98e472d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 0 deletions

View file

@ -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'));