You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
export const cached = (fn: any) => {
// Create an object to store the results returned after each function execution.
const cache = Object.create(null);
// Returns the wrapped function
return function cachedFn(str: any) {
// If the cache is not hit, the function will be executed
if (!cache[str]) {
const result: any = fn(str);
// Store the result of the function execution in the cache
cache[str] = result;
}
return cache[str];
};
};
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: