Skip to content

Commit b18b045

Browse files
committed
commenting code yall
1 parent 8aa2014 commit b18b045

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

community/memoize-one/src/5.0.0/transform.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export default function transformer(
4343
) {
4444
const customEqualityFn = j.arrowFunctionExpression(
4545
[j.identifier('newArgs'), j.identifier('lastArgs')],
46+
// Exit early if the newArgs and lastArgs are different lengths
4647
j.blockStatement([
4748
j.ifStatement(
4849
j.binaryExpression(
@@ -58,9 +59,11 @@ export default function transformer(
5859
),
5960
j.blockStatement([j.returnStatement(j.booleanLiteral(false))]),
6061
),
62+
// create a __equalityFn constant that points to the existing equality function
6163
j.variableDeclaration('const', [
6264
j.variableDeclarator(j.identifier('__equalityFn'), equalityFn),
6365
]),
66+
// Call the original equalityFn for each argument
6467
j.returnStatement(
6568
j.callExpression(
6669
j.memberExpression(

0 commit comments

Comments
 (0)