Skip to content

Commit 9ad8d8b

Browse files
committed
Move regexp out of function
1 parent 7d8d0db commit 9ad8d8b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/formats.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,10 @@ function uri(str: string): boolean {
197197
return NOT_URI_FRAGMENT.test(str) && URI.test(str)
198198
}
199199

200+
const BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm
201+
200202
function byte(str: string): boolean {
201-
const BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm
203+
BYTE.lastIndex = 0
202204
return BYTE.test(str)
203205
}
204206

0 commit comments

Comments
 (0)