File: readme.md

package info (click to toggle)
node-prepend-http 2.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 104 kB
  • sloc: makefile: 2; sh: 2
file content (56 lines) | stat: -rw-r--r-- 862 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# prepend-http [![Build Status](https://travis-ci.org/sindresorhus/prepend-http.svg?branch=master)](https://travis-ci.org/sindresorhus/prepend-http)

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


## Install

```
$ npm install prepend-http
```


## Usage

```js
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`<br>
Default: `false`

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


## License

MIT © [Sindre Sorhus](https://sindresorhus.com)