We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bca8364 commit 6d903abCopy full SHA for 6d903ab
function/memoizeShallow.js
@@ -1,3 +1,5 @@
1
+import memoizeWith from "./memoizeWith";
2
+
3
const equalsShallow = (xs, ys) =>
4
xs.length === ys.length && xs.every((x, index) => x === ys[index]);
5
function/memoizeWith.js
@@ -1,12 +1,15 @@
export default equals => f => {
let memoized = undefined;
let memoizedArgs = undefined;
return (...args) => {
6
if (memoized && equals(args, memoizedArgs)) {
7
return memoized;
8
}
9
10
memoized = f(...args);
11
memoizedArgs = args;
12
13
14
};
15
0 commit comments