From 68b4f955db6cf44e1ce14f58c2b499ab4bab3e62 Mon Sep 17 00:00:00 2001 From: Alexander Rose <alexander.rose@weirdbyte.de> Date: Sun, 24 Feb 2019 18:34:28 -0800 Subject: [PATCH] memoize docs --- src/mol-util/memoize.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mol-util/memoize.ts b/src/mol-util/memoize.ts index d74f25380..c91d1f3e7 100644 --- a/src/mol-util/memoize.ts +++ b/src/mol-util/memoize.ts @@ -4,6 +4,7 @@ * @author David Sehnal <david.sehnal@gmail.com> */ + /** Cache the latest result from calls to a function with any number of arguments */ export function memoizeLatest<Args extends any[], T>(f: (...args: Args) => T): (...args: Args) => T { let lastArgs: any[] | undefined = void 0, value: any = void 0; return (...args) => { @@ -23,6 +24,7 @@ export function memoizeLatest<Args extends any[], T>(f: (...args: Args) => T): ( } } +/** Cache all results from calls to a function with a single argument */ export function memoize1<A, T>(f: (a: A) => T): (a: A) => T { const cache = new Map<A, T>(); return a => { -- GitLab