is-url-external
v2.0.1
Published
A simple function that tells you whether an URL is external or not.
Downloads
4,298
Maintainers
Readme
Is URL External?
A simple function that tells you whether an URL is external or not.
Usage
import { isUrlExternal } from "./index";
isUrlExternal('https://github.com/mrded/is-url-external', 'github.com'); // false
const isExternal = (url: string) => isUrlExternal(url, window.location.hostname);
isExternal('https://github.com/mrded/is-url-external'); // true | false