mirror of
https://github.com/liriliri/eruda.git
synced 2026-02-02 09:49:00 +08:00
Fix: Json string escape
This commit is contained in:
@@ -34,7 +34,7 @@ export default class Console extends Tool
|
||||
origConsole = {},
|
||||
winConsole = window.console;
|
||||
|
||||
function override(name)
|
||||
CONSOLE_METHOD.forEach((name) =>
|
||||
{
|
||||
var origin = origConsole[name] = winConsole[name];
|
||||
|
||||
@@ -44,9 +44,7 @@ export default class Console extends Tool
|
||||
|
||||
origin.apply(winConsole, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
CONSOLE_METHOD.forEach((name) => override(name));
|
||||
});
|
||||
|
||||
this._origConsole = origConsole;
|
||||
|
||||
|
||||
@@ -474,10 +474,12 @@ function stringify(obj, simple, visited)
|
||||
|
||||
function escapeJsonStr(str)
|
||||
{
|
||||
return str.replace(/\n/g, '\\n')
|
||||
.replace(/\r/, '\\r')
|
||||
return str.replace(/\\/g, '\\\\')
|
||||
.replace(/"/g, '\\"')
|
||||
.replace(/\t/g, '\\t');
|
||||
.replace(/\f/g, '\\f')
|
||||
.replace(/\n/g, '\\n')
|
||||
.replace(/\r/g, '')
|
||||
.replace(/\t/g, '');
|
||||
}
|
||||
|
||||
function sortName(a, b)
|
||||
|
||||
Reference in New Issue
Block a user