Sha256: 8ae0aafe46a22c9749264195d058c90dc0ff5dca640d9765e4547672785b9ea5

Contents?: true

Size: 288 Bytes

Versions: 33

Compression:

Stored size: 288 Bytes

Contents

'use strict';
module.exports = function (url) {
	if (typeof url !== 'string') {
		throw new TypeError('Expected a string, got ' + typeof url);
	}

	url = url.trim();

	if (/^\.*\/|^(?!localhost)\w+:/.test(url)) {
		return url;
	}

	return url.replace(/^(?!(?:\w+:)?\/\/)/, 'http://');
};

Version data entries

33 entries across 32 versions & 12 rubygems

Version Path
ezii-os-5.2.1 node_modules/prepend-http/index.js
ezii-os-2.0.1 node_modules/prepend-http/index.js
ezii-os-1.1.0 node_modules/prepend-http/index.js
ezii-os-1.0.0 node_modules/prepend-http/index.js
ezii-os-0.0.0.1.0 node_modules/prepend-http/index.js
ezii-os-0.0.0.0.1 node_modules/prepend-http/index.js
optimacms-0.4.3 spec/dummy/node_modules/prepend-http/index.js
optimacms-0.4.2 spec/dummy/node_modules/prepend-http/index.js
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/prepend-http/index.js
locomotivecms-3.4.0 app/javascript/node_modules/prepend-http/index.js
cortex-0.1.3 spec/dummy/node_modules/prepend-http/index.js
dragonfly_puppeteer-0.1.0 node_modules/gh-got/node_modules/prepend-http/index.js
lanes-0.8.0 node_modules/prepend-http/index.js