Memoize the results of calls to the RegExp constructor, avoiding repetitive runtime compilation of the same regex string and options. Version 0.4.4 (last released 2016) is stable but unmaintained; no updates in 8+ years. It caches based on stringified arguments, providing performance improvements when options are few and primitive, but not recommended for modern Node.js as V8's RegExp caching has improved significantly.
npm install regex-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to wrap a regex-creation function with cache() and benchmark the performance difference.
Consider using native RegExp caching or a modern alternative like p-memoize.
Only use with primitive arguments or override the comparator (not supported by the API).
Manually clear the cache or use a library with built-in eviction like lru-cache.
Use const cache = require('regex-cache'); or import cache from 'regex-cache'; (if bundling).Run npm install regex-cache and use require() (CommonJS) or ensure your bundler handles CJS.
Ensure the wrapped function does not invoke cache again on itself.
No dependency data recorded yet.