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

@ -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;

View file

@ -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);

View file

@ -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);
}

View file

@ -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);

View file

@ -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]);