Noble Programming Mantra

protocolify

2.0.0 • Public • Published

protocolify Build Status

Prepend http:// to humanized URLs like todomvc.com and file:// to file paths

Useful when you want to accept either a local file or URL as argument in your CLI app.

Install

$ npm install --save protocolify

Usage

const protocolify = require('protocolify');
 
protocolify('todomvc.com');
//=> 'http://todomvc.com'
 
protocolify('localhost');
//=> 'http://localhost'
 
protocolify('http://todomvc.com');
//=> 'http://todomvc.com'
 
// if it exists on disk it will be interpreted as a file and not an URL
protocolify('index.js');
//=> 'file:///Users/sindresorhus/dev/protocolify/index.js'

License

MIT © Sindre Sorhus

install

npm i protocolify

Downloadsweekly downloads

1,971

version

2.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability