prepend-http

  • Version 4.0.0
  • Published
  • 3.91 kB
  • No dependencies
  • MIT license

Install

npm i prepend-http
yarn add prepend-http
pnpm add prepend-http

Overview

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

Index

Functions

Interfaces

Functions

function prependHttp

prependHttp: (url: string, options?: Options) => string;
  • Prepend https:// to humanized URLs like sindresorhus.com and localhost.

    Parameter url

    The URL to prepend https:// to.

    Example 1

    import prependHttp from 'prepend-http';
    prependHttp('sindresorhus.com');
    //=> 'https://sindresorhus.com'
    prependHttp('localhost', {https: false});
    //=> 'http://localhost'
    prependHttp('https://sindresorhus.com');
    //=> 'https://sindresorhus.com'

Interfaces

interface Options

interface Options {}

    property https

    readonly https?: boolean;
    • Prepend https:// instead of http://.

      true

    Package Files (1)

    Dependencies (0)

    No dependencies.

    Dev Dependencies (3)

    Peer Dependencies (0)

    No peer dependencies.

    Badge

    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/prepend-http.

    • Markdown
      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/prepend-http)
    • HTML
      <a href="https://www.jsdocs.io/package/prepend-http"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>