Projekt

Obecné

Profil

Stáhnout (413 Bajtů) Statistiky
| Větev: | Revize:
1
'use strict';
2

    
3
module.exports = url => {
4
	if (typeof url !== 'string') {
5
		throw new TypeError(`Expected a \`string\`, got \`${typeof url}\``);
6
	}
7

    
8
	// Don't match Windows paths `c:\`
9
	if (/^[a-zA-Z]:\\/.test(url)) {
10
		return false;
11
	}
12

    
13
	// Scheme: https://tools.ietf.org/html/rfc3986#section-3.1
14
	// Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3
15
	return /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(url);
16
};
(2-2/5)