Skip to content

Commit e097396

Browse files
committed
Fix memoize() breaking calling context
1 parent da2ce63 commit e097396

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/decko.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ let fns = {
66
/** let cachedFn = memoize(originalFn); */
77
memoize(fn, opt=EMPTY, target=null) {
88
let cache = opt.cache || {};
9-
return (...a) => {
9+
return function(...a) {
1010
let k = String(a[0]);
1111
if (opt.caseSensitive===false) k = k.toLowerCase();
12-
return HOP.call(cache,k) ? cache[k] : (cache[k] = fn.apply(target, a));
12+
return HOP.call(cache,k) ? cache[k] : (cache[k] = fn.apply(this, a));
1313
};
1414
},
1515

0 commit comments

Comments
 (0)