You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

prepend-http

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prepend-http

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


Version published
Weekly downloads
10M
increased by2.97%
Maintainers
1
Install size
4.85 kB
Created
Weekly downloads
 

Package description

What is prepend-http?

The prepend-http npm package is a utility that ensures a URL has a protocol (http or https) prepended to it. This is useful for normalizing URLs and ensuring they are valid for HTTP requests.

What are prepend-http's main functionalities?

Prepend HTTP to URL

This feature allows you to prepend 'http://' to a URL if it does not already have a protocol. This is useful for ensuring that URLs are valid for HTTP requests.

const prependHttp = require('prepend-http');
const url = 'example.com';
const fullUrl = prependHttp(url);
console.log(fullUrl); // 'http://example.com'

Prepend HTTPS to URL

This feature allows you to prepend 'https://' to a URL if it does not already have a protocol. This is useful for ensuring that URLs are secure.

const prependHttp = require('prepend-http');
const url = 'example.com';
const fullUrl = prependHttp(url, {https: true});
console.log(fullUrl); // 'https://example.com'

Other packages similar to prepend-http

Readme

Source

prepend-http

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

Install

$ npm install prepend-http

Usage

import prependHttp from '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://.


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.

Keywords

FAQs

Package last updated on 09 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc