Skip to content

Commit aca5190

Browse files
committed
Remove another abuse of reduce()
1 parent e9a865a commit aca5190

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

apps/src/netsim/NetSimVisualization.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -442,12 +442,9 @@ NetSimVisualization.prototype.distributeForegroundNodes = function () {
442442
// Two nodes: Placed across from each other, local node on left
443443
if (foregroundNodes.length === 2) {
444444
myNode = this.localNode;
445-
var otherNode = foregroundNodes.reduce(function (prev, cur) {
446-
if (cur !== this.localNode) {
447-
return cur;
448-
}
449-
return prev;
450-
}.bind(this));
445+
var otherNode = _.find(foregroundNodes, function (node) {
446+
return node !== myNode;
447+
});
451448
myNode.tweenToPosition(-75, 0, 400, tweens.easeOutQuad);
452449
otherNode.tweenToPosition(75, 0, 600, tweens.easeOutQuad);
453450
return;

0 commit comments

Comments
 (0)