diff --git a/src/js/git/index.js b/src/js/git/index.js index d92567d7..abbf4408 100644 --- a/src/js/git/index.js +++ b/src/js/git/index.js @@ -1551,11 +1551,9 @@ GitEngine.prototype.fakeTeamwork = function(numToMake, branch) { var deferred = Q.defer(); var chain = deferred.promise; - _.each(_.range(numToMake), function(i) { - chain = chain.then(function() { - return chainStep(); - }); - }); + for(var i = 0; i < numToMake; i++) { + chain = chain.then(chainStep); + } this.animationQueue.thenFinish(chain, deferred); }; @@ -2074,7 +2072,7 @@ GitEngine.prototype.hgRebase = function(destination, base) { var masterSet = {}; masterSet[baseCommit.get('id')] = true; - _.each([upstream, downstream].concat(moreSets), function(set) { + [upstream, downstream].concat(moreSets).forEach(function(set) { _.each(set, function(val, id) { masterSet[id] = true; }); @@ -2085,7 +2083,7 @@ GitEngine.prototype.hgRebase = function(destination, base) { var upstreamSet = this.getUpstreamBranchSet(); _.each(masterSet, function(val, commitID) { // now loop over that commits branches - _.each(upstreamSet[commitID], function(branchJSON) { + upstreamSet[commitID].forEach(function(branchJSON) { branchMap[branchJSON.id] = true; }); }); diff --git a/src/js/graph/index.js b/src/js/graph/index.js index ed2c0745..584f788d 100644 --- a/src/js/graph/index.js +++ b/src/js/graph/index.js @@ -85,7 +85,7 @@ var Graph = { var commitJSON = tree.commits[objID]; var parentObjs = []; - _.each(commitJSON.parents, function(parentID) { + commitJSON.parents.forEach(function(parentID) { parentObjs.push(this.getOrMakeRecursive(tree, createdSoFar, parentID)); }, this); @@ -143,7 +143,7 @@ var Graph = { var here = queue.pop(); var rents = here.get('parents'); - _.each(rents, addToExplored); + (rents || []).forEach(addToExplored); } return exploredSet; }, @@ -151,7 +151,7 @@ var Graph = { getUniqueObjects: function(objects) { var unique = {}; var result = []; - _.forEach(objects, function(object) { + objects.forEach(function(object) { if (unique[object.id]) { return; } diff --git a/src/js/graph/treeCompare.js b/src/js/graph/treeCompare.js index 823076b0..6318a3ec 100644 --- a/src/js/graph/treeCompare.js +++ b/src/js/graph/treeCompare.js @@ -115,7 +115,7 @@ TreeCompare.compareAllTagsWithinTrees = function(treeA, treeB) { TreeCompare.compareBranchesWithinTrees = function(treeA, treeB, branches) { var result = true; - _.each(branches, function(branchName) { + branches.forEach(function(branchName) { result = result && this.compareBranchWithinTrees(treeA, treeB, branchName); }, this); @@ -176,7 +176,7 @@ TreeCompare.compareBranchesWithinTreesHashAgnostic = function(treeA, treeB, bran var recurseCompare = this.getRecurseCompareHashAgnostic(treeA, treeB); var result = true; - _.each(branches, function(branchName) { + branches.forEach(function(branchName) { var branchA = treeA.branches[branchName]; var branchB = treeB.branches[branchName]; @@ -217,7 +217,7 @@ TreeCompare.evalAssertsOnBranch = function(tree, branchName, asserts) { } var result = true; - _.each(asserts, function(assert) { + asserts.forEach(function(assert) { try { result = result && assert(data); } catch (err) { @@ -305,7 +305,7 @@ TreeCompare.getRecurseCompare = function(treeA, treeB, options) { // so the index lookup is valid. for merge commits this will duplicate some of the // checking (because we aren't doing graph search) but it's not a huge deal var maxNumParents = Math.max(commitA.parents.length, commitB.parents.length); - _.each(_.range(maxNumParents), function(index) { + for (var index = 0; index < maxNumParents; index++) { var pAid = commitA.parents[index]; var pBid = commitB.parents[index]; @@ -315,7 +315,7 @@ TreeCompare.getRecurseCompare = function(treeA, treeB, options) { var childB = treeB.commits[pBid]; result = result && recurseCompare(childA, childB); - }, this); + } // if each of our children recursively are equal, we are good return result; }; @@ -377,7 +377,7 @@ TreeCompare.reduceTreeFields = function(trees) { tags: {} }; - _.each(trees, function(tree) { + trees.forEach(function(tree) { _.each(treeDefaults, function(val, key) { if (tree[key] === undefined) { tree[key] = val; @@ -391,7 +391,7 @@ TreeCompare.reduceTreeFields = function(trees) { _.each(objects, function(obj, objKey) { // our blank slate to copy over var blank = {}; - _.each(saveFields, function(field) { + saveFields.forEach(function(field) { if (obj[field] !== undefined) { blank[field] = obj[field]; } else if (defaults[field] !== undefined) { @@ -410,7 +410,7 @@ TreeCompare.reduceTreeFields = function(trees) { }); }; - _.each(trees, function(tree) { + trees.forEach(function(tree) { saveOnly(tree, 'commits', commitSaveFields, commitSortFields); saveOnly(tree, 'branches', branchSaveFields); saveOnly(tree, 'tags', tagSaveFields); diff --git a/src/js/level/parseWaterfall.js b/src/js/level/parseWaterfall.js index 4a711f4f..d84fde97 100644 --- a/src/js/level/parseWaterfall.js +++ b/src/js/level/parseWaterfall.js @@ -68,7 +68,7 @@ ParseWaterfall.prototype.addLast = function(which, value) { }; ParseWaterfall.prototype.expandAllShortcuts = function(commandStr) { - _.each(this.shortcutWaterfall, function(shortcutMap) { + this.shortcutWaterfall.forEach(function(shortcutMap) { commandStr = this.expandShortcut(commandStr, shortcutMap); }, this); return commandStr; @@ -87,13 +87,13 @@ ParseWaterfall.prototype.expandShortcut = function(commandStr, shortcutMap) { }; ParseWaterfall.prototype.processAllInstants = function(commandStr) { - _.each(this.instantWaterfall, function(instantCommands) { + this.instantWaterfall.forEach(function(instantCommands) { this.processInstant(commandStr, instantCommands); }, this); }; ParseWaterfall.prototype.processInstant = function(commandStr, instantCommands) { - _.each(instantCommands, function(tuple) { + instantCommands.forEach(function(tuple) { var regex = tuple[0]; var results = regex.exec(commandStr); if (results) { @@ -109,7 +109,7 @@ ParseWaterfall.prototype.parseAll = function(commandStr) { } var toReturn = false; - _.each(this.parseWaterfall, function(parseFunc) { + this.parseWaterfall.forEach(function(parseFunc) { var results = parseFunc(commandStr); if (results) { toReturn = results; @@ -120,4 +120,3 @@ ParseWaterfall.prototype.parseAll = function(commandStr) { }; exports.ParseWaterfall = ParseWaterfall; - diff --git a/src/js/models/commandModel.js b/src/js/models/commandModel.js index 07f02c87..b8a9569f 100644 --- a/src/js/models/commandModel.js +++ b/src/js/models/commandModel.js @@ -93,7 +93,7 @@ var Command = Backbone.Model.extend({ deleteOptions: function(options) { var map = this.getOptionsMap(); - _.each(options, function(option) { + options.forEach(function(option) { delete map[option]; }, this); this.setOptionsMap(map); diff --git a/src/js/sandbox/commands.js b/src/js/sandbox/commands.js index 83a741b0..8e3f57b1 100644 --- a/src/js/sandbox/commands.js +++ b/src/js/sandbox/commands.js @@ -98,7 +98,7 @@ var instantCommands = [ intl.str('show-all-commands'), '
' ]; - _.each(allCommands, function(regex, command) { + allCommands.forEach(function(regex, command) { lines.push(command); }); @@ -144,7 +144,7 @@ var getAllCommands = function() { allCommands[vcs + ' ' + method] = regex; }); }); - _.each(toDelete, function(key) { + toDelete.forEach(function(key) { delete allCommands[key]; }); diff --git a/src/js/stores/LevelStore.js b/src/js/stores/LevelStore.js index 3b160c3e..9f951b06 100644 --- a/src/js/stores/LevelStore.js +++ b/src/js/stores/LevelStore.js @@ -41,7 +41,7 @@ var validateLevel = function(level) { 'solutionCommand' ]; - _.each(requiredFields, function(field) { + requiredFields.forEach(function(field) { if (level[field] === undefined) { console.log(level); throw new Error('I need this field for a level: ' + field); @@ -59,7 +59,7 @@ _.each(levelSequences, function(levels, levelSequenceName) { } // for this particular sequence... - _.each(levels, function(level, index) { + levels.forEach(function(level, index) { validateLevel(level); var id = levelSequenceName + String(index + 1); diff --git a/src/js/views/commandViews.js b/src/js/views/commandViews.js index 63ebef01..8dfa71ef 100644 --- a/src/js/views/commandViews.js +++ b/src/js/views/commandViews.js @@ -173,7 +173,7 @@ var CommandPromptView = Backbone.View.extend({ which.reverse(); var str = ''; - _.each(which, function(text) { + which.forEach(function(text) { str += text + ';'; }, this); @@ -202,4 +202,3 @@ var CommandPromptView = Backbone.View.extend({ }); exports.CommandPromptView = CommandPromptView; - diff --git a/src/js/views/gitDemonstrationView.js b/src/js/views/gitDemonstrationView.js index 13b0469f..fc1da36d 100644 --- a/src/js/views/gitDemonstrationView.js +++ b/src/js/views/gitDemonstrationView.js @@ -168,7 +168,7 @@ var GitDemonstrationView = ContainedBase.extend({ var chainDeferred = Q.defer(); var chainPromise = chainDeferred.promise; - _.each(commands, function(command, index) { + commands.forEach(function(command, index) { chainPromise = chainPromise.then(function() { var myDefer = Q.defer(); this.mainVis.gitEngine.dispatch(command, myDefer); diff --git a/src/js/views/levelDropdownView.js b/src/js/views/levelDropdownView.js index cfbfec3d..faf95b33 100644 --- a/src/js/views/levelDropdownView.js +++ b/src/js/views/levelDropdownView.js @@ -292,7 +292,7 @@ var LevelDropdownView = ContainedBase.extend({ $(selector).toggleClass('selected', value); // also go find the series and update the about - _.each(this.seriesViews, function(view) { + this.seriesViews.forEach(function(view) { if (view.levelIDs.indexOf(id) === -1) { return; } @@ -343,14 +343,14 @@ var LevelDropdownView = ContainedBase.extend({ }, updateSolvedStatus: function() { - _.each(this.seriesViews, function(view) { + this.seriesViews.forEach(function(view) { view.updateSolvedStatus(); }, this); }, buildSequences: function() { this.seriesViews = []; - _.each(this.getSequencesOnTab(), function(sequenceName) { + this.getSequencesOnTab().forEach(function(sequenceName) { this.seriesViews.push(new SeriesView({ destination: this.$el, name: sequenceName, @@ -377,7 +377,7 @@ var SeriesView = BaseView.extend({ this.levelIDs = []; var firstLevelInfo = null; - _.each(this.levels, function(level) { + this.levels.forEach(function(level) { if (firstLevelInfo === null) { firstLevelInfo = this.formatLevelAbout(level.id); } diff --git a/src/js/views/multiView.js b/src/js/views/multiView.js index d85bafb9..9a3981ae 100644 --- a/src/js/views/multiView.js +++ b/src/js/views/multiView.js @@ -142,7 +142,7 @@ var MultiView = Backbone.View.extend({ // other views will take if they need to this.keyboardListener.mute(); - _.each(this.childViews, function(childView) { + this.childViews.forEach(function(childView) { childView.die(); }); @@ -183,7 +183,7 @@ var MultiView = Backbone.View.extend({ render: function() { // go through each and render... show the first - _.each(this.childViewJSONs, function(childViewJSON, index) { + this.childViewJSONs.forEach(function(childViewJSON, index) { var childView = this.createChildView(childViewJSON); this.childViews.push(childView); this.addNavToView(childView, index); diff --git a/src/js/views/rebaseView.js b/src/js/views/rebaseView.js index accae218..b79e0b64 100644 --- a/src/js/views/rebaseView.js +++ b/src/js/views/rebaseView.js @@ -19,7 +19,7 @@ var InteractiveRebaseView = ContainedBase.extend({ this.rebaseEntries = new RebaseEntryCollection(); options.toRebase.reverse(); - _.each(options.toRebase, function(commit) { + options.toRebase.forEach(function(commit) { var id = commit.get('id'); this.rebaseMap[id] = commit; @@ -63,7 +63,7 @@ var InteractiveRebaseView = ContainedBase.extend({ // now get the real array var toRebase = []; - _.each(uiOrder, function(id) { + uiOrder.forEach(function(id) { // the model pick check if (this.entryObjMap[id].get('pick')) { toRebase.unshift(this.rebaseMap[id]); diff --git a/src/js/visuals/index.js b/src/js/visuals/index.js index 604afef6..08fe4db6 100644 --- a/src/js/visuals/index.js +++ b/src/js/visuals/index.js @@ -58,7 +58,7 @@ GitVisuals.prototype.defer = function(action) { }; GitVisuals.prototype.deferFlush = function() { - _.each(this.deferred, function(action) { + this.deferred.forEach(function(action) { action(); }, this); this.deferred = []; @@ -68,17 +68,17 @@ GitVisuals.prototype.resetAll = function() { // make sure to copy these collections because we remove // items in place and underscore is too dumb to detect length change var edges = this.visEdgeCollection.toArray(); - _.each(edges, function(visEdge) { + edges.forEach(function(visEdge) { visEdge.remove(); }, this); var branches = this.visBranchCollection.toArray(); - _.each(branches, function(visBranch) { + branches.forEach(function(visBranch) { visBranch.remove(); }, this); var tags = this.visTagCollection.toArray(); - _.each(tags, function(visTag) { + tags.forEach(function(visTag) { visTag.remove(); }, this); @@ -332,7 +332,7 @@ GitVisuals.prototype.explodeNodes = function(speed) { // are called unnecessarily when they have almost // zero speed. would be interesting to see performance differences var keepGoing = []; - _.each(funcs, function(func) { + funcs.forEach(function(func) { if (func()) { keepGoing.push(func); } @@ -485,7 +485,7 @@ GitVisuals.prototype.getBlendedHuesForCommit = function(commit) { GitVisuals.prototype.blendHuesFromBranchStack = function(branchStackArray) { var hueStrings = []; - _.each(branchStackArray, function(branchWrapper) { + branchStackArray.forEach(function(branchWrapper) { var fill = branchWrapper.obj.get('visBranch').get('fill'); if (fill.slice(0,3) !== 'hsb') { @@ -525,7 +525,7 @@ GitVisuals.prototype.getCommitUpstreamStatus = function(commit) { GitVisuals.prototype.calcTagStacks = function() { var tags = this.gitEngine.getTags(); var map = {}; - _.each(tags, function(tag) { + tags.forEach(function(tag) { var thisId = tag.target.get('id'); map[thisId] = map[thisId] || []; @@ -542,7 +542,7 @@ GitVisuals.prototype.calcTagStacks = function() { GitVisuals.prototype.calcBranchStacks = function() { var branches = this.gitEngine.getBranches(); var map = {}; - _.each(branches, function(branch) { + branches.forEach(function(branch) { var thisId = branch.target.get('id'); map[thisId] = map[thisId] || []; @@ -572,7 +572,7 @@ GitVisuals.prototype.calcWidth = function() { GitVisuals.prototype.maxWidthRecursive = function(commit) { var childrenTotalWidth = 0; - _.each(commit.get('children'), function(child) { + commit.get('children').forEach(function(child) { // only include this if we are the "main" parent of // this child if (child.isMainParent(commit)) { @@ -601,14 +601,14 @@ GitVisuals.prototype.assignBoundsRecursive = function(commit, min, max) { // basic box-flex model var totalFlex = 0; var children = commit.get('children'); - _.each(children, function(child) { + children.forEach(function(child) { if (child.isMainParent(commit)) { totalFlex += child.get('visNode').getMaxWidthScaled(); } }, this); var prevBound = min; - _.each(children, function(child, index) { + children.forEach(function(child, index) { if (!child.isMainParent(commit)) { return; } @@ -777,7 +777,7 @@ GitVisuals.prototype.calcDepthRecursive = function(commit, depth) { var children = commit.get('children'); var maxDepth = depth; - _.each(children, function(child) { + children.forEach(function(child) { var d = this.calcDepthRecursive(child, depth + 1); maxDepth = Math.max(d, maxDepth); }, this); @@ -924,7 +924,7 @@ function blendHueStrings(hueStrings) { var totalBright = 0; var length = hueStrings.length; - _.each(hueStrings, function(hueString) { + hueStrings.forEach(function(hueString) { var exploded = hueString.split('(')[1]; exploded = exploded.split(')')[0]; exploded = exploded.split(','); diff --git a/src/js/visuals/tree.js b/src/js/visuals/tree.js index 5d9b92dd..42de848c 100644 --- a/src/js/visuals/tree.js +++ b/src/js/visuals/tree.js @@ -3,7 +3,7 @@ var Backbone = require('backbone'); var VisBase = Backbone.Model.extend({ removeKeys: function(keys) { - _.each(keys, function(key) { + keys.forEach(function(key) { if (this.get(key)) { this.get(key).remove(); } @@ -25,7 +25,7 @@ var VisBase = Backbone.Model.extend({ var attr = this.getAttributes(); // safely insert this attribute into all the keys we want - _.each(keys.include, function(key) { + keys.include.forEach(function(key) { attr[key] = Object.assign( {}, attr[key], @@ -33,7 +33,7 @@ var VisBase = Backbone.Model.extend({ ); }); - _.each(keys.exclude, function(key) { + keys.exclude.forEach(function(key) { delete attr[key]; }); @@ -42,4 +42,3 @@ var VisBase = Backbone.Model.extend({ }); exports.VisBase = VisBase; - diff --git a/src/js/visuals/visBase.js b/src/js/visuals/visBase.js index 5196a575..bc4ace2a 100644 --- a/src/js/visuals/visBase.js +++ b/src/js/visuals/visBase.js @@ -3,7 +3,7 @@ var Backbone = require('backbone'); var VisBase = Backbone.Model.extend({ removeKeys: function(keys) { - _.each(keys, function(key) { + keys.forEach(function(key) { if (this.get(key)) { this.get(key).remove(); } @@ -35,14 +35,14 @@ var VisBase = Backbone.Model.extend({ }, setAttrBase: function(keys, attr, instant, speed, easing) { - _.each(keys, function(key) { + keys.forEach(function(key) { if (instant) { this.get(key).attr(attr[key]); } else { this.get(key).stop(); this.get(key).animate(attr[key], speed, easing); // some keys don't support animating too, so set those instantly here - _.forEach(this.getNonAnimateKeys(), function(nonAnimateKey) { + this.getNonAnimateKeys().forEach(function(nonAnimateKey) { if (attr[key] && attr[key][nonAnimateKey] !== undefined) { this.get(key).attr(nonAnimateKey, attr[key][nonAnimateKey]); } @@ -70,7 +70,7 @@ var VisBase = Backbone.Model.extend({ var attr = this.getAttributes(); // safely insert this attribute into all the keys we want - _.each(keys.include, function(key) { + keys.include.forEach(function(key) { attr[key] = Object.assign( {}, attr[key], @@ -78,7 +78,7 @@ var VisBase = Backbone.Model.extend({ ); }); - _.each(keys.exclude, function(key) { + keys.exclude.forEach(function(key) { delete attr[key]; }); @@ -87,4 +87,3 @@ var VisBase = Backbone.Model.extend({ }); exports.VisBase = VisBase; - diff --git a/src/js/visuals/visBranch.js b/src/js/visuals/visBranch.js index 27fadfc4..73a55305 100644 --- a/src/js/visuals/visBranch.js +++ b/src/js/visuals/visBranch.js @@ -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; - diff --git a/src/js/visuals/visEdge.js b/src/js/visuals/visEdge.js index b47ef8de..cf1d7cea 100644 --- a/src/js/visuals/visEdge.js +++ b/src/js/visuals/visEdge.js @@ -15,7 +15,7 @@ var VisEdge = VisBase.extend({ validateAtInit: function() { var required = ['tail', 'head']; - _.each(required, function(key) { + required.forEach(function(key) { if (!this.get(key)) { throw new Error(key + ' is required!'); } diff --git a/src/js/visuals/visNode.js b/src/js/visuals/visNode.js index 6d3e5cb9..5b42138b 100644 --- a/src/js/visuals/visNode.js +++ b/src/js/visuals/visNode.js @@ -261,33 +261,33 @@ var VisNode = VisBase.extend({ }, setOutgoingEdgesOpacity: function(opacity) { - _.each(this.get('outgoingEdges'), function(edge) { + this.get('outgoingEdges').forEach(function(edge) { edge.setOpacity(opacity); }); }, animateOutgoingEdgesToAttr: function(snapShot, speed, easing) { - _.each(this.get('outgoingEdges'), function(edge) { + this.get('outgoingEdges').forEach(function(edge) { var attr = snapShot[edge.getID()]; edge.animateToAttr(attr); }, this); }, animateOutgoingEdges: function(speed, easing) { - _.each(this.get('outgoingEdges'), function(edge) { + this.get('outgoingEdges').forEach(function(edge) { edge.animateUpdatedPath(speed, easing); }, this); }, animateOutgoingEdgesFromSnapshot: function(snapshot, speed, easing) { - _.each(this.get('outgoingEdges'), function(edge) { + this.get('outgoingEdges').forEach(function(edge) { var attr = snapshot[edge.getID()]; edge.animateToAttr(attr, speed, easing); }, this); }, setOutgoingEdgesBirthPosition: function(parentCoords) { - _.each(this.get('outgoingEdges'), function(edge) { + this.get('outgoingEdges').forEach(function(edge) { var headPos = edge.get('head').getScreenCoords(); var path = edge.genSmoothBezierPathStringFromCoords(parentCoords, headPos); edge.get('path').stop(); @@ -334,7 +334,7 @@ var VisNode = VisBase.extend({ } var commandStr = 'git checkout ' + this.get('commit').get('id'); var Main = require('../app'); - _.each([this.get('circle'), this.get('text')], function(rObj) { + [this.get('circle'), this.get('text')].forEach(function(rObj) { rObj.click(function() { Main.getEventBaton().trigger('commandSubmitted', commandStr); }); @@ -347,7 +347,7 @@ var VisNode = VisBase.extend({ // set the opacity on my stuff var keys = ['circle', 'text']; - _.each(keys, function(key) { + keys.forEach(function(key) { this.get(key).attr({ opacity: opacity }); @@ -371,7 +371,7 @@ var VisNode = VisBase.extend({ }, removeAllEdges: function() { - _.each(this.get('outgoingEdges'), function(edge) { + this.get('outgoingEdges').forEach(function(edge) { edge.remove(); }, this); }, diff --git a/src/js/visuals/visTag.js b/src/js/visuals/visTag.js index f11afe3a..3c22d47c 100644 --- a/src/js/visuals/visTag.js +++ b/src/js/visuals/visTag.js @@ -95,7 +95,7 @@ var VisTag = VisBase.extend({ var myArray = this.getTagStackArray(); var index = -1; - _.each(myArray, function(Tag, i) { + myArray.forEach(function(Tag, i) { if (Tag.obj == this.get('tag')) { index = i; } @@ -175,7 +175,7 @@ var VisTag = VisBase.extend({ var textNode = this.get('text').node; var maxWidth = 0; - _.each(this.getTagStackArray(), function(Tag) { + this.getTagStackArray().forEach(function(Tag) { maxWidth = Math.max(maxWidth, getTextWidth( Tag.obj.get('visTag') )); @@ -271,7 +271,7 @@ var VisTag = VisBase.extend({ // set CSS var keys = ['text', 'rect']; - _.each(keys, function(key) { + keys.forEach(function(key) { $(this.get(key).node).css(attr.css); }, this); @@ -289,7 +289,7 @@ var VisTag = VisBase.extend({ this.get('text') ]; - _.each(objs, function(rObj) { + objs.forEach(function(rObj) { rObj.click(this.onClick.bind(this)); }, this); }, @@ -405,4 +405,3 @@ var VisTagCollection = Backbone.Collection.extend({ exports.VisTagCollection = VisTagCollection; exports.VisTag = VisTag; exports.randomHueString = randomHueString; -