json-schema-describes-subset
Version:
Tools for static JSON schema analysis, including functions to determine if one schema describes a subset of another or if a schema describes the empty set or to convert a schema to its disjunctive normal form (DNF).
13 lines • 373 B
JavaScript
export function createCachedFunction(func) {
const cache = new Map();
return function (arg) {
const cached = cache.get(arg);
if (cached !== undefined && cache.has(arg)) {
return cached;
}
const result = func(arg);
cache.set(arg, result);
return result;
};
}
//# sourceMappingURL=cached-function.js.map