1 |
3a515b92
|
cagy
|
# is-absolute-url [](https://travis-ci.org/sindresorhus/is-absolute-url)
|
2 |
|
|
|
3 |
|
|
> Check if a URL is absolute
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
## Install
|
7 |
|
|
|
8 |
|
|
```
|
9 |
|
|
$ npm install is-absolute-url
|
10 |
|
|
```
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
## Usage
|
14 |
|
|
|
15 |
|
|
```js
|
16 |
|
|
const isAbsoluteUrl = require('is-absolute-url');
|
17 |
|
|
|
18 |
|
|
isAbsoluteUrl('https://sindresorhus.com/foo/bar');
|
19 |
|
|
//=> true
|
20 |
|
|
|
21 |
|
|
isAbsoluteUrl('//sindresorhus.com');
|
22 |
|
|
//=> false
|
23 |
|
|
|
24 |
|
|
isAbsoluteUrl('foo/bar');
|
25 |
|
|
//=> false
|
26 |
|
|
```
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
## Related
|
30 |
|
|
|
31 |
|
|
See [is-relative-url](https://github.com/sindresorhus/is-relative-url) for the inverse.
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
---
|
35 |
|
|
|
36 |
|
|
<div align="center">
|
37 |
|
|
<b>
|
38 |
|
|
<a href="https://tidelift.com/subscription/pkg/npm-is-absolute-url?utm_source=npm-is-absolute-url&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
39 |
|
|
</b>
|
40 |
|
|
<br>
|
41 |
|
|
<sub>
|
42 |
|
|
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
43 |
|
|
</sub>
|
44 |
|
|
</div>
|