mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 09:07:54 +01:00
Minor code review re. https://github.com/uBlockOrigin/uBlock-issues/issues/658
This commit is contained in:
parent
c499ce82a9
commit
9ef06da310
1 changed files with 6 additions and 6 deletions
|
@ -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 a new issue