1.0.0 • Published 12 months ago

prepend-protocol v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

⚙️ Installation

npm i prepend-protocol

CDN Links:

📖 Usage

◎ Import

// ES6
import prependProtocol from "prepend-protocol";

// commonjs
const prependProtocol = require("prepend-protocol");

◎ Prepend protocol

prependProtocol("www.example.com");            // "https://www.example.com"
prependProtocol("localhost")                   // "https://localhost"

// default protocol is always set to "https"
prependProtocol("ftp://www.example.com");      // "https://www.example.com"

prependProtocol("example.com", "ftp");         // "ftp://example.com"
prependProtocol("https://example.com", "ftp"); // "ftp://example.com"

Support me on Patreon - Check out my socials