From 70b7a72bd7f7d7ff7bcb5c7aead45e69d8ae8398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EF=BC=A8=EF=BD=8F=EF=BD=8E=EF=BD=87=EF=BD=81=EF=BD=92?= =?UTF-8?q?=EF=BD=83?= Date: Wed, 5 Dec 2018 12:18:35 +0700 Subject: [PATCH] Use Object.values instead of _.each : 96ddb50 --- src/js/visuals/index.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/js/visuals/index.js b/src/js/visuals/index.js index 9029c2d5..31afd596 100644 --- a/src/js/visuals/index.js +++ b/src/js/visuals/index.js @@ -1,4 +1,3 @@ -var _ = require('underscore'); var Q = require('q'); var intl = require('../intl'); @@ -83,7 +82,7 @@ GitVisuals.prototype.resetAll = function() { visTag.remove(); }, this); - _.each(this.visNodeMap, function(visNode) { + Object.values(this.visNodeMap).forEach(function(visNode) { visNode.remove(); }, this); @@ -207,7 +206,7 @@ GitVisuals.prototype.animateAllAttrKeys = function(keys, attr, speed, easing) { this.visBranchCollection.each(animate); this.visEdgeCollection.each(animate); this.visTagCollection.each(animate); - _.each(this.visNodeMap, animate); + Object.values(this.visNodeMap).forEach(animate); var time = (speed !== undefined) ? speed : GRAPHICS.defaultAnimationTime; setTimeout(function() { @@ -322,7 +321,7 @@ GitVisuals.prototype.finishAnimation = function(speed) { GitVisuals.prototype.explodeNodes = function(speed) { var deferred = Q.defer(); var funcs = []; - _.each(this.visNodeMap, function(visNode) { + Object.values(this.visNodeMap).forEach(function(visNode) { funcs.push(visNode.getExplodeStepFunc(speed)); }); @@ -369,7 +368,7 @@ GitVisuals.prototype.animateAllFromAttrToAttr = function(fromSnapshot, toSnapsho this.visBranchCollection.each(animate); this.visEdgeCollection.each(animate); this.visTagCollection.each(animate); - _.each(this.visNodeMap, animate); + Object.values(this.visNodeMap).forEach(animate); }; /*************************************** @@ -393,7 +392,7 @@ GitVisuals.prototype.genSnapshot = function() { this.fullCalc(); var snapshot = {}; - _.each(this.visNodeMap, function(visNode) { + Object.values(this.visNodeMap).forEach(function(visNode) { snapshot[visNode.get('id')] = visNode.getAttributes(); }, this); @@ -633,7 +632,7 @@ GitVisuals.prototype.calcDepth = function() { } var depthIncrement = this.getDepthIncrement(maxDepth); - _.each(this.visNodeMap, function(visNode) { + Object.values(this.visNodeMap).forEach(function(visNode) { visNode.setDepthBasedOn(depthIncrement, this.getHeaderOffset()); }, this); }; @@ -656,7 +655,7 @@ GitVisuals.prototype.calcDepth = function() { **************************************/ GitVisuals.prototype.animateNodePositions = function(speed) { - _.each(this.visNodeMap, function(visNode) { + Object.values(this.visNodeMap).forEach(function(visNode) { visNode.animateUpdatedPosition(speed); }, this); }; @@ -854,7 +853,7 @@ GitVisuals.prototype.zIndexReflow = function() { }; GitVisuals.prototype.visNodesFront = function() { - _.each(this.visNodeMap, function(visNode) { + Object.values(this.visNodeMap).forEach(function(visNode) { visNode.toFront(); }); }; @@ -893,7 +892,7 @@ GitVisuals.prototype.drawTreeFirstTime = function() { this.gitReady = true; this.calcTreeCoords(); - _.each(this.visNodeMap, function(visNode) { + Object.values(this.visNodeMap).forEach(function(visNode) { visNode.genGraphics(this.paper); }, this);