Skip to content

Instantly share code, notes, and snippets.

View PetukhovArt's full-sized avatar
🏠
Working from home

Artem Petukhov PetukhovArt

🏠
Working from home
View GitHub Profile
const plusFunction = (a: number, b: number) => a + b;
const memoFunction = (fn: (...args: any) => any) => {
const cache: Record<string, any> = {};
return (...args: any) => {
const key = JSON.stringify(args);
if (cache[key]) {
return cache[key];
}
const result = fn(...args);