Skip to content

Commit

Permalink
Meta tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed May 21, 2024
1 parent a083b95 commit 400a6ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const ESCAPES = new Set([27, 155]);
const CODE_POINT_0 = '0'.codePointAt(0);
const CODE_POINT_9 = '9'.codePointAt(0);

const MAX_ANSI_SEQUENCE_LENGTH = 19;

const endCodesSet = new Set();
const endCodesMap = new Map();
for (const [start, end] of ansiStyles.codes) {
Expand Down Expand Up @@ -48,7 +50,7 @@ function findNumberIndex(string) {
}

function parseAnsiCode(string, offset) {
string = string.slice(offset, offset + 19);
string = string.slice(offset, offset + MAX_ANSI_SEQUENCE_LENGTH);
const startIndex = findNumberIndex(string);
if (startIndex !== -1) {
let endIndex = string.indexOf('m', startIndex);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"types": "./index.d.ts",
"default": "./index.js"
},
"sideEffects": false,
"engines": {
"node": ">=18"
},
Expand Down

0 comments on commit 400a6ca

Please sign in to comment.