main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
754 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | exports.__esModule = true;
|
---|
| 4 | exports.default = void 0;
|
---|
| 5 | var _ramda = require("ramda");
|
---|
| 6 | /**
|
---|
| 7 | * decodeURIComponent can throw URIError in certain cases like 'c%d'.
|
---|
| 8 | * safeDecodeURIComponent is a safe variant of decodeURIComponent that never trows.
|
---|
| 9 | *
|
---|
| 10 | * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Malformed_URI|More info about URIError}
|
---|
| 11 | */
|
---|
| 12 | const safeDecodeURIComponent = encodedURIComponent => {
|
---|
| 13 | try {
|
---|
| 14 | return decodeURIComponent(encodedURIComponent);
|
---|
| 15 | } catch {
|
---|
| 16 | return encodedURIComponent;
|
---|
| 17 | }
|
---|
| 18 | };
|
---|
| 19 |
|
---|
| 20 | // unescape :: String -> String
|
---|
| 21 | const unescape = (0, _ramda.pipe)((0, _ramda.replace)(/~1/g, '/'), (0, _ramda.replace)(/~0/g, '~'), safeDecodeURIComponent);
|
---|
| 22 | var _default = exports.default = unescape; |
---|
Note:
See
TracBrowser
for help on using the repository browser.