source: trip-planner-front/node_modules/decode-uri-component/readme.md@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.6 KB
Line 
1# decode-uri-component
2
3[![Build Status](https://travis-ci.org/SamVerschueren/decode-uri-component.svg?branch=master)](https://travis-ci.org/SamVerschueren/decode-uri-component) [![Coverage Status](https://coveralls.io/repos/SamVerschueren/decode-uri-component/badge.svg?branch=master&service=github)](https://coveralls.io/github/SamVerschueren/decode-uri-component?branch=master)
4
5> A better [decodeURIComponent](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent)
6
7
8## Why?
9
10- Decodes `+` to a space.
11- Converts the [BOM](https://en.wikipedia.org/wiki/Byte_order_mark) to a [replacement character](https://en.wikipedia.org/wiki/Specials_(Unicode_block)#Replacement_character) `�`.
12- Does not throw with invalid encoded input.
13- Decodes as much of the string as possible.
14
15
16## Install
17
18```
19$ npm install --save decode-uri-component
20```
21
22
23## Usage
24
25```js
26const decodeUriComponent = require('decode-uri-component');
27
28decodeUriComponent('%25');
29//=> '%'
30
31decodeUriComponent('%');
32//=> '%'
33
34decodeUriComponent('st%C3%A5le');
35//=> 'ståle'
36
37decodeUriComponent('%st%C3%A5le%');
38//=> '%ståle%'
39
40decodeUriComponent('%%7Bst%C3%A5le%7D%');
41//=> '%{ståle}%'
42
43decodeUriComponent('%7B%ab%%7C%de%%7D');
44//=> '{%ab%|%de%}'
45
46decodeUriComponent('%FE%FF');
47//=> '\uFFFD\uFFFD'
48
49decodeUriComponent('%C2');
50//=> '\uFFFD'
51
52decodeUriComponent('%C2%B5');
53//=> 'µ'
54```
55
56
57## API
58
59### decodeUriComponent(encodedURI)
60
61#### encodedURI
62
63Type: `string`
64
65An encoded component of a Uniform Resource Identifier.
66
67
68## License
69
70MIT © [Sam Verschueren](https://github.com/SamVerschueren)
Note: See TracBrowser for help on using the repository browser.