ensure-http
ensures that http is prepended to a url
Last updated 5 years ago by pmoelgaard .
MIT · Original npm · Tarball · package.json
$ cnpm install ensure-http 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.0.2                                ...           latest (5 years ago)

2 Versions

  • 0.0.2                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2021 © npmmirror.com |