is-url-external
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

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

Dependents (10)

Package Sidebar

Install

npm i is-url-external

Weekly Downloads

1,056

Version

2.0.1

License

WTFPL

Unpacked Size

3.31 kB

Total Files

7

Last publish

Collaborators

  • mrded