UNPKG

328 BJavaScriptView Raw
1"use strict";
2
3const isURL = require('is-url'); // Matches anchor (ie: #raptors)
4
5
6const ANCHOR_REGEXP = /^#/; // Matches scheme (ie: tel:, mailto:, data:, itms-apps:)
7
8const SCHEME_REGEXP = /^[a-z][a-z0-9\-+.]*:/i;
9
10module.exports = function (url) {
11 return isURL(url) || ANCHOR_REGEXP.test(url) || SCHEME_REGEXP.test(url);
12};
\No newline at end of file