You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
511 B
18 lines
511 B
"use strict"; |
|
|
|
exports.__esModule = true; |
|
exports.default = unesc; |
|
var HEX_ESC = /\\(?:([0-9a-fA-F]{6})|([0-9a-fA-F]{1,5})(?: |(?![0-9a-fA-F])))/g; |
|
var OTHER_ESC = /\\(.)/g; |
|
function unesc(str) { |
|
str = str.replace(HEX_ESC, function (_, hex1, hex2) { |
|
var hex = hex1 || hex2; |
|
var code = parseInt(hex, 16); |
|
return String.fromCharCode(code); |
|
}); |
|
str = str.replace(OTHER_ESC, function (_, char) { |
|
return char; |
|
}); |
|
return str; |
|
} |
|
module.exports = exports["default"]; |