the-math
v1.5.5
Published
TheMath is an extensive math library for JavaScript and Node.js. It features a flexible expression parser
Maintainers
Readme

TheMath
Lib with function to execute operations arithmetics, and you can resolve string operation with resolve.
Installation
You can install with npm:
npm install the-mathYou can install with yarn:
yarn add the-mathFeatures
- chain - Solve a chain of complex operations.
- subtract - Solve subtraction between 2 numbers.
- Sum - Solve sum between 2 numbers.
- divide - Solve division between 2 numbers.
- multiply - Solve multiplication between 2 numbers.
- resolve - Solve a string operation arithmetic.
Exemples
1. Solve a chain of complex operations.
import TheMath from 'the-math';
const chain = TheMath.createChain({
round: {
type: 'floor',
precision: 2
}
});
const result = chain(4.91231).plus(2.12413).done();
// result: 7.032. Solve subtraction between 2 numbers.
import TheMath from 'the-math';
const result = TheMath.subtract(10, 3);
// result: 73. Solve sum between 2 numbers.
import TheMath from 'the-math';
const result = TheMath.sum(14, 7);
// result: 214. Solve division between 2 numbers.
import TheMath from 'the-math';
const result = TheMath.divide(21, 3);
// result: 75. Solve multiplication between 2 numbers.
import TheMath from 'the-math';
const result = TheMath.multiply(6, 3);
// result: 186. Solve a string operation arithmetic.
import TheMath from 'the-math';
const result = TheMath.resolve('12+4*3*9/2+1');
// result: 67Contributors
| @allyfx | | :---: |
Author
| @TheMarkWill | | :---: |
