Skip to content

Commit fb34c15

Browse files
committed
Use _.some instead of includes
1 parent b5ffae5 commit fb34c15

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/assets/javascripts/components/generic_object/assign-buttons.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function assignButtonsController() {
8282
indexes.forEach(function(index) {
8383
movedElements.push(vm.model.assignedButtons[index]);
8484
});
85-
_.remove(vm.model.assignedButtons, function(n) { return movedElements.includes(n) });
85+
_.remove(vm.model.assignedButtons, function(n) { return _.some(movedElements, n) });
8686
vm.model.unassignedButtons = vm.model.unassignedButtons.concat( movedElements);
8787
vm.updateButtons(vm.model.assignedButtons, vm.model.unassignedButtons);
8888
};
@@ -94,7 +94,7 @@ function assignButtonsController() {
9494
indexes.forEach(function(index) {
9595
movedElements.push(vm.model.unassignedButtons[index]);
9696
});
97-
_.remove(vm.model.unassignedButtons, function(n) { return movedElements.includes(n) });
97+
_.remove(vm.model.unassignedButtons, function(n) { return _.some(movedElements, n) });
9898
vm.model.assignedButtons = vm.model.assignedButtons.concat( movedElements);
9999
vm.updateButtons(vm.model.assignedButtons, vm.model.unassignedButtons);
100100
};
@@ -134,7 +134,7 @@ function assignButtonsController() {
134134
indexes.forEach(function(index) {
135135
movedElements.push(vm.model.assignedButtons[index]);
136136
});
137-
_.remove(vm.model.assignedButtons, function(n) { return movedElements.includes(n) });
137+
_.remove(vm.model.assignedButtons, function(n) { return _.some(movedElements, n) });
138138
vm.model.assignedButtons = movedElements.concat( vm.model.assignedButtons);
139139
vm.updateButtons(vm.model.assignedButtons, vm.model.unassignedButtons);
140140
};
@@ -146,7 +146,7 @@ function assignButtonsController() {
146146
indexes.forEach(function(index) {
147147
movedElements.push(vm.model.assignedButtons[index]);
148148
});
149-
_.remove(vm.model.assignedButtons, function(n) { return movedElements.includes(n) });
149+
_.remove(vm.model.assignedButtons, function(n) { return _.some(movedElements, n) });
150150
vm.model.assignedButtons = vm.model.assignedButtons.concat(movedElements);
151151
vm.updateButtons(vm.model.assignedButtons, vm.model.unassignedButtons);
152152
};

0 commit comments

Comments
 (0)