Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -256,16 +256,16 @@ let worker = {

function cachingDecorator(func, hash) {
let cache = new Map();
return function() {
return function(...args) {
*!*
let key = hash(arguments); // (*)
let key = hash(args); // (*)
*/!*
if (cache.has(key)) {
return cache.get(key);
}

*!*
let result = func.call(this, ...arguments); // (**)
let result = func.call(this, ...args); // (**)
*/!*

cache.set(key, result);
@@ -274,7 +274,7 @@ function cachingDecorator(func, hash) {
}

function hash(args) {
return args[0] + ',' + args[1];
return args.toString();
}

worker.slow = cachingDecorator(worker.slow, hash);