1.0.1 • Published 2 years ago
safer-url v1.0.1
safer-url
Wrapper around the native URL type but returns null for invalid URLs instead of throwing an error.
Installation
Install safer-url with your favorite package manager:
npm install safer-urlUsage
import safeURL from 'safer-url';
console.log(safeURL('https://tunnel.dev')); // new URL(...)
console.log(safeURL('invalid')); // null