2
0
Эх сурвалжийг харах

Use an arrow function inside forEach() instead of an anonymous function

Suggested by deepcode.ai.
Marc Hartmayer 5 жил өмнө
parent
commit
b2fee6a6c1

+ 2 - 2
client/components/boards/boardBody.js

@@ -365,12 +365,12 @@ BlazeComponent.extendComponent({
         };
         currentBoard
           .cardsInInterval(start.toDate(), end.toDate())
-          .forEach(function(card) {
+          .forEach(card => {
             pushEvent(card);
           });
         currentBoard
           .cardsDueInBetween(start.toDate(), end.toDate())
-          .forEach(function(card) {
+          .forEach(card => {
             pushEvent(
               card,
               `${card.title} ${TAPi18n.__('card-due')}`,

+ 2 - 2
client/components/cards/cardDetails.js

@@ -805,9 +805,9 @@ Template.copyChecklistToManyCardsPopup.events({
 
         // copy subtasks
         cursor = Cards.find({ parentId: oldId });
-        cursor.forEach(function() {
+        cursor.forEach(cur => {
           'use strict';
-          const subtask = arguments[0];
+          const subtask = cur;
           subtask.parentId = _id;
           subtask._id = null;
           /* const newSubtaskId = */ Cards.insert(subtask);

+ 1 - 1
client/components/sidebar/sidebar.js

@@ -653,7 +653,7 @@ BlazeComponent.extendComponent({
             'subtext-with-parent',
             'no-parent',
           ];
-          options.forEach(function(element) {
+          options.forEach(element => {
             if (element !== value) {
               $(`#${element} ${MCB}`).toggleClass(CKCLS, false);
               $(`#${element}`).toggleClass(CKCLS, false);

+ 3 - 3
models/checklists.js

@@ -100,13 +100,13 @@ Checklists.helpers({
   },
   checkAllItems() {
     const checkItems = ChecklistItems.find({ checklistId: this._id });
-    checkItems.forEach(function(item) {
+    checkItems.forEach(item => {
       item.check();
     });
   },
   uncheckAllItems() {
     const checkItems = ChecklistItems.find({ checklistId: this._id });
-    checkItems.forEach(function(item) {
+    checkItems.forEach(item => {
       item.uncheck();
     });
   },
@@ -307,7 +307,7 @@ if (Meteor.isServer) {
             items = [items];
           }
         }
-        items.forEach(function(item, idx) {
+        items.forEach((item, idx) => {
           ChecklistItems.insert({
             cardId: paramCardId,
             checklistId: id,

+ 1 - 1
server/rulesHelper.js

@@ -17,7 +17,7 @@ RulesHelper = {
     const matchingMap = this.buildMatchingFieldsMap(activity, matchingFields);
     const matchingTriggers = Triggers.find(matchingMap);
     const matchingRules = [];
-    matchingTriggers.forEach(function(trigger) {
+    matchingTriggers.forEach(trigger => {
       const rule = trigger.getRule();
       // Check that for some unknown reason there are some leftover triggers
       // not connected to any rules