Replace MapCache by Map in memoize (#4094) (#4095)

This commit is contained in:
Luiz Américo
2018-12-01 14:09:30 -03:00
committed by John-David Dalton
parent 3b199c30e0
commit 508d46a7a4

View File

@@ -1,5 +1,3 @@
import MapCache from './.internal/MapCache.js'
/** /**
* Creates a function that memoizes the result of `func`. If `resolver` is * Creates a function that memoizes the result of `func`. If `resolver` is
* provided, it determines the cache key for storing the result based on the * provided, it determines the cache key for storing the result based on the
@@ -57,10 +55,10 @@ function memoize(func, resolver) {
memoized.cache = cache.set(key, result) || cache memoized.cache = cache.set(key, result) || cache
return result return result
} }
memoized.cache = new (memoize.Cache || MapCache) memoized.cache = new (memoize.Cache || Map)
return memoized return memoized
} }
memoize.Cache = MapCache memoize.Cache = Map
export default memoize export default memoize