Skip to content

Commit

Permalink
Use _.some instead of includes
Browse files Browse the repository at this point in the history
  • Loading branch information
ZitaNemeckova committed Jan 24, 2019
1 parent b5ffae5 commit fb34c15
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function assignButtonsController() {
indexes.forEach(function(index) {
movedElements.push(vm.model.assignedButtons[index]);
});
_.remove(vm.model.assignedButtons, function(n) { return movedElements.includes(n) });
_.remove(vm.model.assignedButtons, function(n) { return _.some(movedElements, n) });
vm.model.unassignedButtons = vm.model.unassignedButtons.concat( movedElements);
vm.updateButtons(vm.model.assignedButtons, vm.model.unassignedButtons);
};
Expand All @@ -94,7 +94,7 @@ function assignButtonsController() {
indexes.forEach(function(index) {
movedElements.push(vm.model.unassignedButtons[index]);
});
_.remove(vm.model.unassignedButtons, function(n) { return movedElements.includes(n) });
_.remove(vm.model.unassignedButtons, function(n) { return _.some(movedElements, n) });
vm.model.assignedButtons = vm.model.assignedButtons.concat( movedElements);
vm.updateButtons(vm.model.assignedButtons, vm.model.unassignedButtons);
};
Expand Down Expand Up @@ -134,7 +134,7 @@ function assignButtonsController() {
indexes.forEach(function(index) {
movedElements.push(vm.model.assignedButtons[index]);
});
_.remove(vm.model.assignedButtons, function(n) { return movedElements.includes(n) });
_.remove(vm.model.assignedButtons, function(n) { return _.some(movedElements, n) });
vm.model.assignedButtons = movedElements.concat( vm.model.assignedButtons);
vm.updateButtons(vm.model.assignedButtons, vm.model.unassignedButtons);
};
Expand All @@ -146,7 +146,7 @@ function assignButtonsController() {
indexes.forEach(function(index) {
movedElements.push(vm.model.assignedButtons[index]);
});
_.remove(vm.model.assignedButtons, function(n) { return movedElements.includes(n) });
_.remove(vm.model.assignedButtons, function(n) { return _.some(movedElements, n) });
vm.model.assignedButtons = vm.model.assignedButtons.concat(movedElements);
vm.updateButtons(vm.model.assignedButtons, vm.model.unassignedButtons);
};
Expand Down

0 comments on commit fb34c15

Please sign in to comment.