UNPKG

detect-external-link

Version:

Node.js plugin that analyzes the given link and determines if the URL is internal or external.

12 lines (9 loc) 271 B
const detectExternalLink = require('detect-external-link').default; const link = 'http://test.example2.com/test/abc/'; const linkOptions = { 'hosts': [ 'http://example.com', 'http://test.example.com' ] }; console.log(detectExternalLink(link, linkOptions));