A super lightweight JavaScript / TypeScript library to check whether a given url is valid and exists or not.
npm install @teamteanpm2024/amet-voluptate-temporibus
A super lightweight library to validate if a given url is valid or not. Some additional features are-
- less than 1 kb in size
- additional configuration to validate as per custom requirement
- supports node.js latest version
- TypeScript and JavaScript support
- built on ES6 modules
- Jest test cases with 100% coverage
- Promise based result
import { linkExists } from '@teamteanpm2024/amet-voluptate-temporibus';
const result = await linkExists('https://stackblogger.com');
console.log(result);
// OUTPUT true
const result = await linkExists('https://some-invalid-url.com');
console.log(result);
// OUTPUT false
const result = await linkExists('stackblogger.com');
console.log(result);
// OUTPUT false
// Configuration
const result = await linkExists('stackblogger.com', { ignoreProtocol: true });
console.log(result);
// OUTPUT true
const { linkExists } = require('@teamteanpm2024/amet-voluptate-temporibus');
const result = await linkExists('https://stackblogger.com');
console.log(result);
// OUTPUT true
const result = await linkExists('https://some-invalid-url.com');
console.log(result);
// OUTPUT false
const result = await linkExists('stackblogger.com');
console.log(result);
// OUTPUT false
// Configuration
const result = await linkExists('stackblogger.com', { ignoreProtocol: true });
console.log(result);
// OUTPUT true