Skip to content

Commit

Permalink
Removing named regex capture groups to support node 8
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaschiasson committed Apr 17, 2020
1 parent 35eee4e commit 2b6a0b4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ const exec = (string, columns, options = {}) => {
ret += character;

if (ESCAPES.has(character)) {
const {groups} = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(pre.slice(index).join('')) || {groups: {}};
if (groups.code !== undefined) {
const code = parseFloat(groups.code);
escapeCode = code === END_CODE ? null : code;
} else if (groups.uri !== undefined) {
escapeUri = groups.uri.length === 0 ? null : groups.uri;
const [, code, uri] = new RegExp(`(?:\\${ANSI_CSI}(\\d+)m|\\${ANSI_ESCAPE_LINK}(.*)${ANSI_ESCAPE_BELL})`).exec(pre.slice(index).join('')) || [];
if (code !== undefined) {
const c = parseFloat(code);
escapeCode = c === END_CODE ? null : c;
} else if (uri !== undefined) {
escapeUri = uri.length === 0 ? null : uri;
}
}

Expand Down

0 comments on commit 2b6a0b4

Please sign in to comment.