UNPKG

@visulima/packem

Version:

A fast and modern bundler for Node.js and TypeScript.

13 lines (12 loc) 626 B
/** * Modified copy of https://github.com/huozhi/bunchee/blob/main/src/lib/memoize.ts * * The MIT License (MIT) * * Copyright (c) 2018 these people -> https://github.com/huozhi/bunchee/graphs/contributors */ type CacheKeyResolver = string | ((...arguments_: any[]) => string); export declare const memoize: <T extends (...arguments_: any[]) => any>(function_: T, cacheKey?: CacheKeyResolver, // if you need specify a cache key cacheArgument?: Map<string, ReturnType<T>>) => T; export declare const memoizeByKey: <T extends (...arguments_: any[]) => any>(function_: T) => ((cacheKey?: CacheKeyResolver) => T); export {};