Have ideas to improve npm?Join in the discussion! »

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

    3.0.1 • Public • Published

    prepend-http Build Status

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

    License

    MIT © Sindre Sorhus

    Install

    npm i prepend-http

    DownloadsWeekly Downloads

    14,803,740

    Version

    3.0.1

    License

    MIT

    Unpacked Size

    3.63 kB

    Total Files

    5

    Last publish

    Collaborators

    • avatar