Prepend http:// to humanized URLs like todomvc.com and localhost
Switch branches/tags
Nothing to show
Clone or download
Latest commit 040579f Sep 23, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig Meta tweaks Sep 23, 2017
.gitattributes ES2015-ify (#6) Jan 19, 2017
.gitignore Meta tweaks Sep 23, 2017
.npmrc Meta tweaks Sep 23, 2017
.travis.yml Meta tweaks Sep 23, 2017
index.js Add `https` option (#8) Sep 23, 2017
license Meta tweaks Sep 23, 2017
package.json 2.0.0 Sep 23, 2017
readme.md Meta tweaks Sep 23, 2017
test.js Add `https` option (#8) Sep 23, 2017

readme.md

prepend-http Build Status

Prepend http:// to humanized URLs like todomvc.com and localhost

Install

$ npm install prepend-http

Usage

const prependHttp = require('prepend-http');

prependHttp('todomvc.com');
//=> 'http://todomvc.com'

prependHttp('localhost');
//=> 'http://localhost'

prependHttp('http://todomvc.com');
//=> 'http://todomvc.com'

prependHttp('todomvc.com', {https: true});
//=> 'https://todomvc.com'

API

prependHttp(url, [options])

url

Type: string

URL to prepend http:// on.

options

Type: Object

https

Type: boolean
Default: false

Prepend https:// instead of http://.

License

MIT © Sindre Sorhus