Skip to content

Commit 400a6ca

Browse files
committed
Meta tweaks
1 parent a083b95 commit 400a6ca

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const ESCAPES = new Set([27, 155]);
77
const CODE_POINT_0 = '0'.codePointAt(0);
88
const CODE_POINT_9 = '9'.codePointAt(0);
99

10+
const MAX_ANSI_SEQUENCE_LENGTH = 19;
11+
1012
const endCodesSet = new Set();
1113
const endCodesMap = new Map();
1214
for (const [start, end] of ansiStyles.codes) {
@@ -48,7 +50,7 @@ function findNumberIndex(string) {
4850
}
4951

5052
function parseAnsiCode(string, offset) {
51-
string = string.slice(offset, offset + 19);
53+
string = string.slice(offset, offset + MAX_ANSI_SEQUENCE_LENGTH);
5254
const startIndex = findNumberIndex(string);
5355
if (startIndex !== -1) {
5456
let endIndex = string.indexOf('m', startIndex);

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"types": "./index.d.ts",
1111
"default": "./index.js"
1212
},
13+
"sideEffects": false,
1314
"engines": {
1415
"node": ">=18"
1516
},

0 commit comments

Comments
 (0)