js: Convert _.reduce to less convoluted code.

reduce is almost never a better solution than the alternatives.  Avoid
it.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg
2020-02-07 21:17:38 -08:00
committed by Tim Abbott
parent 050915c46c
commit e1cf5e4630
3 changed files with 8 additions and 14 deletions

View File

@@ -58,10 +58,8 @@ class MarkdownComparer {
if (node1.content.childNodes.length !== node2.content.childNodes.length) {
return false;
}
return _.reduce(
_.zip(node1.content.childNodes, node2.content.childNodes),
(prev, nodePair) => { return prev && nodePair[0].isEqualNode(nodePair[1]); },
true
return _.zip(node1.content.childNodes, node2.content.childNodes).every(([child1, child2]) =>
child1.isEqualNode(child2)
);
}