Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a3c2ef9

Browse filesBrowse files
avivkellermarco-ippolito
authored andcommitted
util: update ansi regex
PR-URL: #54865 Refs: chalk/ansi-regex#58 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 30383ff commit a3c2ef9
Copy full SHA for a3c2ef9

File tree

Expand file treeCollapse file tree

1 file changed

+10
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-7
lines changed
Open diff view settings
Collapse file

‎lib/internal/util/inspect.js‎

Copy file name to clipboardExpand all lines: lib/internal/util/inspect.js
+10-7Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,17 @@ const meta = [
241241
];
242242

243243
// Regex used for ansi escape code splitting
244-
// Adopted from https://github.com/chalk/ansi-regex/blob/HEAD/index.js
245-
// License: MIT, authors: @sindresorhus, Qix-, arjunmehta and LitoMore
244+
// Ref: https://github.com/chalk/ansi-regex/blob/f338e1814144efb950276aac84135ff86b72dc8e/index.js
245+
// License: MIT by Sindre Sorhus <sindresorhus@gmail.com>
246246
// Matches all ansi escape code sequences in a string
247-
const ansiPattern = '[\\u001B\\u009B][[\\]()#;?]*' +
248-
'(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*' +
249-
'|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)' +
250-
'|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))';
251-
const ansi = new RegExp(ansiPattern, 'g');
247+
const ansi = new RegExp(
248+
'[\\u001B\\u009B][[\\]()#;?]*' +
249+
'(?:(?:(?:(?:;[-a-zA-Z\\d\\/\\#&.:=?%@~_]+)*' +
250+
'|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/\\#&.:=?%@~_]*)*)?' +
251+
'(?:\\u0007|\\u001B\\u005C|\\u009C))' +
252+
'|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?' +
253+
'[\\dA-PR-TZcf-nq-uy=><~]))', 'g',
254+
);
252255

253256
let getStringWidth;
254257

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.