The following code works and has 4 conditions but I want to simplify it since they are really 150 conditions, is there any other way to reduce this algorithm and not 150 else if?
for (var j = 0; j < $scope.cants.length; j++) {
if ($scope.cants[j].type === "bases") {
$scope.bases += $scope.cants[j].quantity;
} else if ($scope.cants[j].type === "proteins") {
$scope.proteins += $scope.cants[j].quantity;
} else if ($scope.cants[j].type === "veggies") {
$scope.veggies += $scope.cants[j].quantity;
} else if ($scope.cants[j].type === "sauces") {
$scope.sauces += $scope.cants[j].quantity;
}
$scope.componentsPlate = $scope.proteins + $scope.veggies + $scope.sauces + $scope.dryfruits + $scope.bases + $scope.proteinsExtra + $scope.veggiesExtra + $scope.saucesExtra + $scope.dryfruitsExtra + $scope.basesExtra
}