pre-installations and preparations
This commit is contained in:
1 parent
3e5a0329cb
commit
201d621ac3
6977 files changed
+742826
No files matched your search
+20
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var weakMemoize = function weakMemoize(func) {
|
||||
// $FlowFixMe flow doesn't include all non-primitive types as allowed for weakmaps
|
||||
var cache = new WeakMap();
|
||||
return function (arg) {
|
||||
if (cache.has(arg)) {
|
||||
// $FlowFixMe
|
||||
return cache.get(arg);
|
||||
}
|
||||
|
||||
var ret = func(arg);
|
||||
cache.set(arg, ret);
|
||||
return ret;
|
||||
};
|
||||
};
|
||||
|
||||
exports["default"] = weakMemoize;
|
||||
Reference in new issue
Block a user