32.0.0 • Published 2 years ago
tachyon-utils-mem
Licence
UNLICENSED
Version
32.0.0
Deps
8
Size
23 kB
Vulns
0
Weekly
0
tachyon-utils-mem
Convenience wrappers around the mem library.
Installation
$ yarn add tachyon-utils-mem
Usage
This package exposes three main memoization strategies:
- simple: shallow comparison of first argument to a function
- deep: deep comparison of all arugments to a function
- lead object keys: shallow comparison of the values of specific keys of the object that is the first argument to a function
Additionally, there is a custom strategy that lets user build cache keys themselves based on the functions args.
These strategies come in both bottomless ("all") and limited ("some", via LRU culling) cache sizes.
Thus, the following functions are available:
- memoizeSimpleAll
- memoizeSimpleSome
- memoizeDeepAll
- memoizeDeepSome
- memoizeLeadObjKeysAll
- memoizeLeadObjKeysSome
- memoizeCustomAll
- memoizeCustomSome