source: trip-planner-front/node_modules/is-absolute-url/index.js@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 413 bytes
Line 
1'use strict';
2
3module.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};
Note: See TracBrowser for help on using the repository browser.