- Improve typings to support
strict
mode in TypeScript
- Create more targeted
getKeyIndex
helpers for more speed in each key situation
- Use standard
then
interface (.then(onFulfilled, onRejected)
) instead of ES spec (.then(onFulfilled).catch(onRejected)
) for broader support
- Fix failure when
getKeyIndex
is used and no keys are in the cache
- Use
.pop()
to cap cache tomaxSize
when possible (slight performance improvement)
- Namespace types under
MicroMemoize
namespace (which is how it was for4.0.0
, but it got lost)
- Make Cache class consumable in types
- Fix types for consumption
- Update to use
Cache
class instead of plain object (~10% performance improvement)
memoized.cacheSnapshot
has been deprecated in favor ofmemoized.cache.snapshot
- Memoizing an already-memoized function no longer returns the function passed (now composes, see Composition)
- You can now compose memoized functions with their options (see Composition)
- Fix types declarations to ensure signature of
fn
passed is retained - Throw an error when the first parameter passed is not a function
- Fix types declaration for
Options
to allow custom keys / indices
- Rewrite in TypeScript
- Use
rollup
for builds of all packages
- CommonJS
require
s no longer require.default
- Types contract is much stricter
- Utility methods are no longer deep-linkable
- Not technically exposed in the API, but was relied upon by other libraries)
- Fix issue where
isMatchingKey
was not being used with promise updater - Remove requirement of
Object.assign
existing globally - Add common use-case static handlers for up to 3 arguments, falling back to pre-existing dynamic handlers for more (faster comparison / argument cloning)
- Upgrade to babel 7
- Add
"sideEffects": false
for better tree-shaking with webpack
- Add ESM support for NodeJS with separate
.mjs
extension exports
- Fix issue with recursive calls to memoized function created discrepancy between
keys
andvalues
in cache
- More TypeScript typings (thanks again @rtorr)
- Fix TypeScript typings (thanks @rtorr)
- Fix TypeScript typings (thanks @Crecket)
- Add
isMatchingKey
method to provide match test on entire key vs iterative equality
BREAKING CHANGES
- The return value from
transformKey
must be anArray
(would previously coalesce it for you)
NEW FEATURES
isMatchingKey
will matching on entire key vsisEqual
, which does an iterative comparison of arguments in order- Add
size
property tocache
- Fix
getKeyIndex
being passed asmemoize
for promises
- Include the memoized function itself as the third parameter to
onCacheAdd
,onCacheChange
, andonCacheHit
firings
- Fire
onCacheHit
andonCacheChange
when promise functions successfully resolve
- Replace native
slice
usages withcloneArray
utility
- Convert
dist
files to be built usingrollup
instead of webpack
- Optimize
slice
calls for key storage (performance)
- Add
onCacheAdd
option - Pass through unused properties in
options
for higher-order memoization library usage
- Add
onCacheHit
option
- Add
options
as second parameter toonCacheChanged
- Make additional properties (
cache
,cacheSnapshot
,isMemoized
,options
) configurable for higher-order memoization library usage
- Only reorder keys when matching cache entry is not first key
- Add
onCacheChange
option
- Add
isPromise
option - Add typings for Flowtype and TypeScript
- Add
transformKey
option
- Delay argument-to-key generation until stored as new cache value (speed improvement of ~35%)
- Initial release