feat: adjustments.

This commit is contained in:
elforjani3
2021-01-13 07:14:38 +02:00
parent c2af716225
commit 244a32e5fd
18 changed files with 582 additions and 272 deletions

View File

@@ -0,0 +1,20 @@
import { add, sumBy, subtract } from 'lodash';
export const calculate = ({ type, quantity_on_hand }, operator) => {
const qty = parseInt(quantity_on_hand);
const quantity = parseInt(operator);
if (type == 'decrement') {
return subtract(qty, quantity);
} else {
return add(qty, quantity);
}
};
// function calculate(qty, operator) {
// return operator > 0
// ? calculate(qty + 1, operator - 1)
// : operator < 0
// ? calculate(qty - 1, operator + 1)
// : qty;
// }