Skip to content

Commit ef9a7d7

Browse files
UziTechstyfle
andauthored
Update src/rules.ts
Co-authored-by: Steven <steven@ceriously.com>
1 parent 2cb28e9 commit ef9a7d7

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/rules.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ const noopTest = { exec: () => null } as unknown as RegExp;
33
function cachedIndentRegex(createRegex: (indent: number) => RegExp) {
44
const cache: RegExp[] = [];
55
return (indent: number) => {
6-
const cappedIndent = Math.max(0, Math.min(3, indent - 1));
7-
const cacheIndex = cappedIndent;
6+
const cacheIndex = Math.max(0, Math.min(3, indent - 1));
87
let regex = cache[cacheIndex];
98
if (!regex) {
10-
regex = createRegex(cappedIndent);
9+
regex = createRegex(cacheIndex);
1110
cache[cacheIndex] = regex;
1211
}
1312
return regex;

0 commit comments

Comments
 (0)