mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 03:12:33 +01:00
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
|
||||
// Modified to backslash-escape ONLY widely-used control characters.
|
||||
function parseString(string) {
|
||||
return string.replace(/\\(.)/g, function(_, ch) {
|
||||
if (ch === "n") return "\n";
|
||||
if (ch === "r") return "\r";
|
||||
if (ch === 't') return '\t';
|
||||
if (ch === '\\') return '\\';
|
||||
return _;
|
||||
return string.replace(/\\[nrt\\]/g, function(match) {
|
||||
if (match === "\\n") return "\n";
|
||||
if (match === "\\r") return "\r";
|
||||
if (match === '\\t') return '\t';
|
||||
if (match === '\\\\') return '\\';
|
||||
return match;
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user