Skip to content

Commit

Permalink
chore(index): add inline comment explaining regex cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Oct 29, 2023
1 parent 6adc0a6 commit 5a33b91
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const errorMessages = {
3221225477: "Segmentation fault",
};

// Cache immutable regex as they are expensive to create and garbage collect
const unrtfPathRegex = /(.+)unrtf/u;
const unrtfVersionRegex = /^(\d{1,2}\.\d{1,2}\.\d{1,2})/u;
const rtfMagicNumberRegex = /^\{\\rtf/u;
Expand Down

0 comments on commit 5a33b91

Please sign in to comment.