We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b46136d commit f605905Copy full SHA for f605905
1 file changed
src/closure.js
@@ -56,9 +56,8 @@ const cacheFunction = (cb) => {
56
// `cb` should only ever be invoked once for a given set of arguments.
57
const cache = {};
58
return (squared) => {
59
- if (!(squared in cache)) {
60
- return cache[squared] = cb[squared];
61
- }
+ if (squared in cache) return cache[squared];
+ cache[squared] = cb(squared);
62
return cache[squared];
63
};
64
0 commit comments