소스 검색

memoize docs

Alexander Rose 6 년 전
부모
커밋
68b4f955db
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      src/mol-util/memoize.ts

+ 2 - 0
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 => {