Add is.urlString (#73)

This commit is contained in:
Itai Steinherz 2018-12-13 17:52:21 +02:00 committed by Sindre Sorhus
parent 2ee148f5a1
commit 566f363632
3 changed files with 40 additions and 1 deletions

View file

@ -576,13 +576,22 @@ test('is.directInstanceOf', t => {
});
test('is.urlInstance', t => {
const url = new URL('https://www.example.com');
const url = new URL('https://example.com');
t.true(is.urlInstance(url));
t.false(is.urlInstance({}));
t.false(is.urlInstance(undefined));
t.false(is.urlInstance(null));
});
test('is.urlString', t => {
const url = 'https://example.com';
t.true(is.urlString(url));
t.false(is.urlString(new URL(url)));
t.false(is.urlString({}));
t.false(is.urlString(undefined));
t.false(is.urlString(null));
});
test('is.truthy', t => {
t.true(is.truthy('unicorn'));
t.true(is.truthy('🦄'));