to-protocol-relative-url
v1.0.3
Published
Change a URL into protocol-relative URL
Downloads
39
Maintainers
Readme
to-protocol-relative-url.js
Change a URL into protocol-relative URL
Installation
Package managers
npm
npm install --save to-protocol-relative-url
Bower
bower install --save to-protocol-relative-url
Standalone
Download the script file directly.
API
toProtocolRelativeUrl(url)
url: String
Return: String
toProtocolRelativeURL('http://example.org');
//=> //example.org
toProtocolRelativeURL('https://github.com/');
//=> //github.com/
toProtocolRelativeURL('[email protected]:npm/npm.git');
//=> [email protected]:npm/npm.git (doesn't change)
toProtocolRelativeURL('Here is http://nodejs.org');
//=> Here is http://nodejs.org (doesn't change)
CLI
You can use this module as a CLI tool by installing it globally.
npm install -g to-protocol-relative-url
Usage
Usage1: to-protocol-relative-url <string>
Usage2: echo <string> | to-protocol-relative-url
Options:
--help, -h Print usage information
--version, -v Print version
License
Copyright (c) 2014 - 2015 Shinnosuke Watanabe
Licensed under the MIT License.