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

2.0.1 • Public • Published

prepend-tls

Prepend https://orhttp:// scheme to URLs.

Install

$ npm install prepend-tls

Usage

import prependTLS from 'prepend-tls';

// Prepend https://
prependTLS('jessegoodenough.com');
//=> 'https://jessegoodenough.com'

// Prepend http://
prependTLS('jessegoodenough.com', { httpOnly: true });
//=> 'http://jessegoodenough.com'

// Already included https:// returns url unchanged
prependTLS('https://jessegoodenough.com');
//=> 'https://jessegoodenough.com'

API

prependTLS(url, options?)

url

Type: string

The URL to prepend https:// or http:// to.

options

Type: object

**httpOnly**

Type: boolean

Default: false

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

Package Sidebar

Install

npm i prepend-tls

Weekly Downloads

1

Version

2.0.1

License

ISC

Unpacked Size

20.1 kB

Total Files

5

Last publish

Collaborators

  • jgoodenough