UNPKG
@baaz/adapter
Version:
latest (1.0.6)
1.0.6
1.0.5
1.0.4
1.0.3
The core runtime of PWA
github.com/dominicg666/baaz-adapter
dominicg666/baaz-adapter
@baaz/adapter
/
util
/
unaryMemoize.js
8 lines
(5 loc)
•
158 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
const
memoize = fn => {
const
cache =
new
Map();
return
x => (cache.has(x) ? cache.
get
(x) : cache.
set
(x, fn(x)).
get
(x)); }; export
default
memoize;