mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-02 21:49:42 +02:00
format
This commit is contained in:
@@ -18,7 +18,8 @@
|
||||
* Note: Has global flag - reset lastIndex before exec() if reusing.
|
||||
*/
|
||||
// eslint-disable-next-line no-control-regex
|
||||
export const ANSI_ESCAPE_PATTERN_FULL = /\x1b(?:\[[0-9;?]*[A-Za-z]|\][^\x07\x1b]*(?:\x07|\x1b\\)|[=>])/g;
|
||||
export const ANSI_ESCAPE_PATTERN_FULL =
|
||||
/\x1b(?:\[[0-9;?]*[A-Za-z]|\][^\x07\x1b]*(?:\x07|\x1b\\)|[=>])/g;
|
||||
|
||||
/**
|
||||
* Simple ANSI CSI-only pattern for basic escape code stripping.
|
||||
|
||||
+9
-11
@@ -4036,17 +4036,15 @@ NOW: Generate the implementation plan for the task above. Think step by step.`;
|
||||
repaired = repaired.replace(/,(\s*[\]}])/g, '$1');
|
||||
// Fix unescaped control characters within JSON strings
|
||||
repaired = repaired.replace(/"([^"\\]|\\.)*"/g, (match) => {
|
||||
return (
|
||||
match
|
||||
.replace(/\n/g, '\\n')
|
||||
.replace(/\r/g, '\\r')
|
||||
.replace(/\t/g, '\\t')
|
||||
.replace(
|
||||
// eslint-disable-next-line no-control-regex
|
||||
/[\x00-\x1f]/g,
|
||||
(c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, '0')}`
|
||||
)
|
||||
);
|
||||
return match
|
||||
.replace(/\n/g, '\\n')
|
||||
.replace(/\r/g, '\\r')
|
||||
.replace(/\t/g, '\\t')
|
||||
.replace(
|
||||
// eslint-disable-next-line no-control-regex
|
||||
/[\x00-\x1f]/g,
|
||||
(c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, '0')}`
|
||||
);
|
||||
});
|
||||
parsed = JSON.parse(repaired);
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user