renovate
Version:
Automated dependency updates. Flexible so you don't need to be.
27 lines (26 loc) • 952 B
JavaScript
import { Minimatch } from "minimatch";
//#region lib/util/minimatch.ts
const cache = /* @__PURE__ */ new Map();
function minimatch(pattern, options, useCache = true) {
const key = options ? `${pattern}:${JSON.stringify(options)}` : pattern;
if (useCache) {
const cachedResult = cache.get(key);
if (cachedResult) return cachedResult;
}
const instance = new Minimatch(pattern, options);
if (useCache) cache.set(key, instance);
return instance;
}
function minimatchFilter(pattern, options, useCache = true) {
const key = options ? `${pattern}:${JSON.stringify(options)}` : pattern;
if (useCache) {
const cachedResult = cache.get(key);
if (cachedResult) return (fileName) => cachedResult.match(fileName);
}
const instance = new Minimatch(pattern, options);
if (useCache) cache.set(key, instance);
return (fileName) => instance.match(fileName);
}
//#endregion
export { minimatch, minimatchFilter };
//# sourceMappingURL=minimatch.js.map