MCPcopy Create free account
hub / github.com/avoidwork/tenso / createCachedRegex

Function createCachedRegex

src/utils/auth.js:66–74  ·  view source on GitHub ↗

* Creates a cached regex pattern to avoid recompiling * @param {string} pattern - The regex pattern string * @param {string} flags - The regex flags * @returns {RegExp} The compiled regex pattern

(pattern, flags = "")

Source from the content-addressed store, hash-verified

64 * @returns {RegExp} The compiled regex pattern
65 */
66function createCachedRegex (pattern, flags = "") {
67 const key = `${pattern}|${flags}`;
68
69 if (!regexCache.has(key)) {
70 regexCache.set(key, new RegExp(pattern, flags));
71 }
72
73 return regexCache.get(key);
74}
75
76/**
77 * Converts a pattern string to a regex pattern with wildcard handling

Callers 1

authFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected