function inc(val, options = [1]) { let [name, amount = 1, ..._rest] = options; return { varName: name, new: val * 1 + amount * 1, old: val * 1, }; } function dec(val, options = [1]) { let [name, amount = 1, ..._rest] = options; return { varName: name, new: val * 1 - amount * 1, old: val * 1, }; } function mult(val, options = [1]) { let [name, amount = 1, ..._rest] = options; return { varName: name, new: val * 1 * amount * 1, old: val * 1, }; } function div(val, options = [1]) { let [name, amount = 1, ..._rest] = options; return { varName: name, new: ((val * 1) / amount) * 1, old: val * 1, }; } function pow(val, options = [1]) { let [name, amount = 1, ..._rest] = options; return { varName: name, new: Math.pow(val * 1, amount * 1), old: val * 1, }; } const BasicArithmetic = new Map([ ['increment', inc], ['increase', inc], ['inc', inc], ['decrement', dec], ['decrease', dec], ['dec', dec], ['multiply', mult], ['mult', mult], ['divide', div], ['div', div], ['pow', pow], ]); export default new Map([...BasicArithmetic.entries()]);