react-validator-dev
Version:
A lightweight and customizable React hook for real-time form validation with field dependency support.
13 lines • 410 B
JavaScript
export default function memoize(fn) {
const cache = new Map();
return function (...args) {
const key = args.map(a => typeof a === 'object' ? JSON.stringify(a) : String(a)).join('|');
if (cache.has(key)) {
return cache.get(key);
}
const result = fn(...args);
cache.set(key, result);
return result;
};
}
//# sourceMappingURL=memomize.js.map