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:
511 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 |
|
---|
3 | exports.__esModule = true;
|
---|
4 | exports.default = unesc;
|
---|
5 | var HEX_ESC = /\\(?:([0-9a-fA-F]{6})|([0-9a-fA-F]{1,5})(?: |(?![0-9a-fA-F])))/g;
|
---|
6 | var OTHER_ESC = /\\(.)/g;
|
---|
7 | function unesc(str) {
|
---|
8 | str = str.replace(HEX_ESC, function (_, hex1, hex2) {
|
---|
9 | var hex = hex1 || hex2;
|
---|
10 | var code = parseInt(hex, 16);
|
---|
11 | return String.fromCharCode(code);
|
---|
12 | });
|
---|
13 | str = str.replace(OTHER_ESC, function (_, char) {
|
---|
14 | return char;
|
---|
15 | });
|
---|
16 | return str;
|
---|
17 | }
|
---|
18 | module.exports = exports["default"]; |
---|
Note:
See
TracBrowser
for help on using the repository browser.