Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/strarsis/percentage-encode-char
Percentage-encodes a single character.
https://github.com/strarsis/percentage-encode-char
Last synced: 13 days ago
JSON representation
Percentage-encodes a single character.
- Host: GitHub
- URL: https://github.com/strarsis/percentage-encode-char
- Owner: strarsis
- License: mit
- Created: 2015-09-24T16:00:54.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-24T16:22:06.000Z (almost 9 years ago)
- Last Synced: 2024-10-18T23:55:18.655Z (about 1 month ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# percentage-encode-char
Percentage-encodes a single character.[![david](https://david-dm.org/strarsis/percentage-encode-char.svg)](https://david-dm.org/strarsis/percentage-encode-char)
[![NPM](https://nodei.co/npm/percentage-encode-char.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/percentage-encode-char/)
In contrast to escape() (deprecated), encodeURI() or encodeURIComponent(), this function will encode any character
regardless whether the particular character needs escaping to adhere to a specific RFC or not.Installation
------------
````
npm install percentage-encode-char
````Usage
-----
````
var percEncode = require('percentage-encode-char');
percEncode('(');
=> '%28'
````
This function will only escape the first passed character, subsequent characters will not be encoded and returned by it.
For encoding multiple characters, a string, use a loop, stream transform callback or similar mechanism for passing each character individually.percentage-encode-char
----------------------
#### char
The character to be percentage encoded.