web-search
Version:
A package to provide search URLs for websites from a search term.
18 lines (17 loc) • 483 B
JavaScript
exports.__esModule = true;
/**
* This is a modified/simplified version of
* [prepend-http](https://github.com/sindresorhus/prepend-http).
*
* @license MIT License - Copyright (c) Sindre Sorhus
* <sindresorhus@gmail.com> (sindresorhus.com)
*/
function prependHttps(url) {
url = url.trim();
if (/^\.*\/|^(?!localhost)\w+:/.test(url)) {
return url;
}
return url.replace(/^(?!(?:\w+:)?\/\/)/, "https://");
}
exports["default"] = prependHttps;
;