Skip to content

Commit 3487f40

Browse files
committed
fix: hoist regex declaration outside of the transform() to avoid recompilation
1 parent 98245a9 commit 3487f40

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib/database.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ const getSqlFileStreamFromCompressedFile = async ( filePath: string ): Promise<
107107
};
108108

109109
export const fixMyDumperTransform = () => {
110+
const regex = /^-- ([^ ]+) \d+$/;
110111
return new Transform( {
111112
transform( chunk: string, _encoding: BufferEncoding, callback: TransformCallback ) {
112113
const chunkString = chunk.toString();
113114
const lineEnding = chunkString.includes( '\r\n' ) ? '\r\n' : '\n';
114-
const regex = /^-- ([^ ]+) \d+$/;
115115
const lines = chunk
116116
.toString()
117117
.split( lineEnding )

0 commit comments

Comments
 (0)