Skip to content

Instantly share code, notes, and snippets.

View PetukhovArt's full-sized avatar
:electron:
Workinnn 😉

Artem Petukhov PetukhovArt

:electron:
Workinnn 😉
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);