🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

ensure-http

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ensure-http

ensures that http is prepended to a url

latest
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

ensure-http

Just a small convenience, based entirely and only on this little script block

function addhttp(url) {
	if (!/^(?:f|ht)tps?\:\/\//.test(url)) {
    	url = "http://" + url;
	}
	return url;
}

All tributable to this post on StackOverflow: http://stackoverflow.com/questions/24657463/how-to-add-http-to-url-if-no-protocol-is-defined-in-javascript

FAQs

Package last updated on 20 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts