We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 935e8b1 commit 8028bd9Copy full SHA for 8028bd9
1 file changed
src/index.mjs
@@ -14,15 +14,17 @@
14
import { MINI } from './constants.mjs';
15
import { build, evaluate } from './build.mjs';
16
17
-const CACHE = new Map();
+const regular = h => {
18
+ const cache = new Map();
19
-const cached = function(statics) {
20
- let tmp = CACHE.get(statics);
21
- if (!tmp) {
22
- CACHE.set(statics, tmp = build(statics));
23
- }
24
- tmp = evaluate(this, tmp, arguments, []);
25
- return tmp.length > 1 ? tmp : tmp[0];
+ return function(statics) {
+ let tmp = cache.get(statics);
+ if (!tmp) {
+ cache.set(statics, tmp = build(statics));
+ }
+ tmp = evaluate(h, tmp, arguments, []);
26
+ return tmp.length > 1 ? tmp : tmp[0];
27
+ };
28
};
29
-export default MINI ? build : cached;
30
+export default MINI ? build : { bind: regular };
0 commit comments