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

@ -255,6 +255,22 @@ is.urlInstance(url);
//=> true
```
### .url(value)
Returns `true` if `value` is a URL string.
Note: this only does basic checking using the [`URL` class](https://developer.mozilla.org/en-US/docs/Web/API/URL) constructor.
```js
const url = 'https://example.com';
is.url(url);
//=> true
is.url(new URL(url));
//=> false
```
##### .truthy(value)
Returns `true` for all values that evaluate to true in a boolean context: