diff options
Diffstat (limited to 'src/shared/utils/re.ts')
-rw-r--r-- | src/shared/utils/re.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/shared/utils/re.ts b/src/shared/utils/re.ts new file mode 100644 index 0000000..34f4fa6 --- /dev/null +++ b/src/shared/utils/re.ts @@ -0,0 +1,6 @@ +const fromWildcard = (pattern: string): RegExp => { + let regexStr = '^' + pattern.replace(/\*/g, '.*') + '$'; + return new RegExp(regexStr); +}; + +export { fromWildcard }; |