to-protocol-relative-url

Change a URL into protocol-relative URL

to-protocol-relative-url.js

Change a URL into protocol-relative URL

npm

npm install --save to-protocol-relative-url

Bower

bower install --save to-protocol-relative-url

Download the script file directly.

url: String
Return: String

toProtocolRelativeURL('http://example.org');
//=> //example.org 
 
toProtocolRelativeURL('https://github.com/');
//=> //github.com/ 
 
toProtocolRelativeURL('git@github.com:npm/npm.git');
//=> git@github.com:npm/npm.git (doesn't change) 
 
toProtocolRelativeURL('Here is http://nodejs.org');
//=> Here is http://nodejs.org (doesn't change) 

You can use this module as a CLI tool by installing it globally.

npm install -g to-protocol-relative-url
Usage1: to-protocol-relative-url <string>
Usage2: echo <string> | to-protocol-relative-url
 
Options:
--help,    -h  Print usage information
--version, -v  Print version

Copyright (c) 2014 - 2015 Shinnosuke Watanabe

Licensed under the MIT License.