Skip to content

Repository files navigation

prepend-http

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

Install

npm install prepend-http

Usage

importprependHttpfrom'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://.

Notes

URLs with authentication information (e.g., login:password@site.com) are returned unchanged as basic auth in URLs is deprecated and to avoid conflicting with custom schemes.

About

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

Resources

Code of conduct

Contributing

Security policy

Stars

66 stars

Watchers

4 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages