prepend-http
TypeScript icon, indicating that this package has built-in type declarations

4.0.0 • Public • Published

prepend-http

Prepend https:// to humanized URLs like sindresorhus.com and localhost

Install

$ npm install prepend-http

Usage

import prependHttp from 'prepend-http';

prependHttp('sindresorhus.com');
//=> 'https://sindresorhus.com'

prependHttp('localhost', {https: false});
//=> 'http://localhost'

prependHttp('https://sindresorhus.com');
//=> 'https://sindresorhus.com'

API

prependHttp(url, options?)

url

Type: string

The URL to prepend https:// to.

options

Type: object

https

Type: boolean
Default: true

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


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 4.0.0
    3,955
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 4.0.0
    3,955
  • 3.0.1
    155,747
  • 3.0.0
    21
  • 2.0.0
    5,466,471
  • 1.0.4
    4,661,686
  • 1.0.3
    237
  • 1.0.2
    166
  • 1.0.1
    195
  • 1.0.0
    5

Package Sidebar

Install

npm i prepend-http

Weekly Downloads

8,601,296

Version

4.0.0

License

MIT

Unpacked Size

3.91 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus