1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-23 22:36:32 +02:00

Chore: Refactor string-utils to TypeScript (#9869)

This commit is contained in:
Henry Heino
2024-02-07 06:16:54 -08:00
committed by GitHub
parent c1e5adf658
commit 01ec640bdb
6 changed files with 103 additions and 106 deletions

View File

@@ -1,3 +1,7 @@
// Leave this file as JavaScript -- our current TypeScript configuration
// generates code that tries to access modules/exports, which is incompatible
// with browser environments.
function pregQuote(str, delimiter = '') {
return (`${str}`).replace(new RegExp(`[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\${delimiter || ''}-]`, 'g'), '\\$&');
}