mirror of https://github.com/gorhill/uBlock.git
Minor code review re. https://github.com/uBlockOrigin/uBlock-issues/issues/658
This commit is contained in:
parent
c499ce82a9
commit
9ef06da310
|
@ -163,12 +163,12 @@
|
||||||
// https://github.com/uBlockOrigin/uBlock-issues/issues/658
|
// https://github.com/uBlockOrigin/uBlock-issues/issues/658
|
||||||
// Modified to backslash-escape ONLY widely-used control characters.
|
// Modified to backslash-escape ONLY widely-used control characters.
|
||||||
function parseString(string) {
|
function parseString(string) {
|
||||||
return string.replace(/\\(.)/g, function(_, ch) {
|
return string.replace(/\\[nrt\\]/g, function(match) {
|
||||||
if (ch === "n") return "\n";
|
if (match === "\\n") return "\n";
|
||||||
if (ch === "r") return "\r";
|
if (match === "\\r") return "\r";
|
||||||
if (ch === 't') return '\t';
|
if (match === '\\t') return '\t';
|
||||||
if (ch === '\\') return '\\';
|
if (match === '\\\\') return '\\';
|
||||||
return _;
|
return match;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue