.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / prepend-http / index.js
1 'use strict';
2 module.exports = function (url) {
3         if (typeof url !== 'string') {
4                 throw new TypeError('Expected a string, got ' + typeof url);
5         }
6
7         url = url.trim();
8
9         if (/^\.*\/|^(?!localhost)\w+:/.test(url)) {
10                 return url;
11         }
12
13         return url.replace(/^(?!(?:\w+:)?\/\/)/, 'http://');
14 };