https://github.com/shinnn/to-protocol-relative-url.js
Change a URL into protocol-relative URL
https://github.com/shinnn/to-protocol-relative-url.js
Last synced: 3 months ago
JSON representation
Change a URL into protocol-relative URL
- Host: GitHub
- URL: https://github.com/shinnn/to-protocol-relative-url.js
- Owner: shinnn
- License: mit
- Created: 2014-09-03T11:09:35.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-07-26T15:52:06.000Z (almost 10 years ago)
- Last Synced: 2024-04-25T11:02:03.991Z (about 1 year ago)
- Language: JavaScript
- Size: 199 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# to-protocol-relative-url.js
[](https://www.npmjs.com/package/to-protocol-relative-url)
[](https://github.com/shinnn/to-protocol-relative-url.js/releases)
[](https://travis-ci.org/shinnn/to-protocol-relative-url.js)
[](https://ci.appveyor.com/project/ShinnosukeWatanabe/to-protocol-relative-url-js)
[](https://coveralls.io/r/shinnn/to-protocol-relative-url.js?branch=master)
[](https://david-dm.org/shinnn/to-protocol-relative-url.js)
[](https://david-dm.org/shinnn/to-protocol-relative-url.js#info=devDependencies)Change a URL into [protocol-relative URL](https://www.paulirish.com/2010/the-protocol-relative-url/)
## Installation
### Package managers
#### [npm](https://www.npmjs.com/)
```
npm install --save to-protocol-relative-url
```#### [Bower](http://bower.io/)
```
bower install --save to-protocol-relative-url
```### Standalone
[Download the script file directly.](https://raw.githubusercontent.com/shinnn/to-protocol-relative-url.js/master/to-protocol-relative-url.js)
## API
### toProtocolRelativeUrl(*url*)
*url*: `String`
Return: `String````javascript
toProtocolRelativeURL('http://example.org');
//=> //example.orgtoProtocolRelativeURL('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](https://docs.npmjs.com/files/folders#global-installation).
```
npm install -g to-protocol-relative-url
```### Usage
```
Usage1: to-protocol-relative-url
Usage2: echo | to-protocol-relative-urlOptions:
--help, -h Print usage information
--version, -v Print version
```## License
Copyright (c) 2014 - 2015 [Shinnosuke Watanabe](https://github.com/shinnn)
Licensed under [the MIT License](./LICENSE).