Travis build: 960

This commit is contained in:
30secondsofcode
2018-01-03 15:04:56 +00:00
parent 496da3e64a
commit 10b0c1d618
3 changed files with 55 additions and 154 deletions

View File

@ -10,9 +10,7 @@ Allow access to the `cache` by setting it as a property on the returned function
const memoize = fn => {
const cache = new Map();
const cached = function(val) {
return cache.has(val)
? cache.get(val)
: cache.set(val, fn.call(this, val)) && cache.get(val);
return cache.has(val) ? cache.get(val) : cache.set(val, fn.call(this, val)) && cache.get(val);
};
cached.cache = cache;
return cached;