'use strict';module.exports=(url,opts)=>{if(typeofurl!=='string'){thrownewTypeError(`Expected \`url\` to be of type \`string\`, got \`${typeofurl}\``);}url=url.trim();opts=Object.assign({https:false},opts);if(/^\.*\/|^(?!localhost)\w+:/.test(url)){returnurl;}returnurl.replace(/^(?!(?:\w+:)?\/\/)/,opts.https?'https://':'http://');};