jpaths / prepend-http

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

prepend-http

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

Install

$ npm install prepend-http

Usage

const prependHttp = require('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

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.

About

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

License:MIT License


Languages

Language:JavaScript 87.3%Language:TypeScript 12.7%