check-absolute-url
v1.0.0
Published
Validate absolute URLs in strings and arrays
Downloads
1
Maintainers
Readme
⚙️ Installation
npm i check-absolute-url
CDN Links:
- https://cdn.jsdelivr.net/npm/[email protected]/check-absolute-url.js
- https://www.unpkg.com/[email protected]/check-absolute-url.js
📖 Usage
▪ Import
// ES6
import checkAbsoluteUrl from "check-absolute-url";
// commonjs
const checkAbsoluteUrl = require("check-absolute-url");
▪ Check with string
const checked = checkAbsoluteUrl('https://www.example.com/path');
console.log(checked); // True
▪ Check with array
const urls = [
'http://localhost:3000',
'ftp://ftp.example.com/file.zip',
'/path',
'example.com',
'C:\\path\\to\\file.txt'
];
const checked = checkAbsoluteUrl(urls);
console.log(checked); // [true, true, false, false, false]