Use 'Array.prototype.forEach' instead of '_.each' and '_.forEach'

This commit is contained in:
Hongarc 2018-12-01 11:28:04 +07:00
parent d87fd095c0
commit bd8009386d
19 changed files with 74 additions and 82 deletions

View file

@ -167,7 +167,7 @@ var VisBranch = VisBase.extend({
var myArray = this.getBranchStackArray();
var index = -1;
_.each(myArray, function(branch, i) {
myArray.forEach(function(branch, i) {
if (branch.obj == this.get('branch')) {
index = i;
}
@ -279,7 +279,7 @@ var VisBranch = VisBase.extend({
arrowInnerLow,
arrowStartLow
];
_.each(coords, function(pos) {
coords.forEach(function(pos) {
pathStr += 'L' + toStringCoords(pos) + ' ';
}, this);
pathStr += 'z';
@ -309,7 +309,7 @@ var VisBranch = VisBase.extend({
}
var maxWidth = 0;
_.each(this.getBranchStackArray(), function(branch) {
this.getBranchStackArray().forEach(function(branch) {
maxWidth = Math.max(maxWidth, getTextWidth(
branch.obj.get('visBranch')
));
@ -432,7 +432,7 @@ var VisBranch = VisBase.extend({
// set CSS
var keys = ['text', 'rect', 'arrow'];
_.each(keys, function(key) {
keys.forEach(function(key) {
$(this.get(key).node).css(attr.css);
}, this);
@ -451,7 +451,7 @@ var VisBranch = VisBase.extend({
this.get('arrow')
];
_.each(objs, function(rObj) {
objs.forEach(function(rObj) {
rObj.click(this.onClick.bind(this));
}, this);
},
@ -577,4 +577,3 @@ var VisBranchCollection = Backbone.Collection.extend({
exports.VisBranchCollection = VisBranchCollection;
exports.VisBranch = VisBranch;
exports.randomHueString = randomHueString;