simple_and_fast_add
Its awesome module. So simple, and so fast
Features
- can sum:
float and float
int and float
float and int
int and int
Install
npm i simple_and_fast_add
and import class Sum from this package
const Sum = require('simple_and_fast_add');
Example
const Sum = require('simple_and_fast_add');
(async () => {
const Adder = new Sum();
await Adder.getValuesStorage()
.addValue(new Sum.Number(5))
.then(indx => {
Adder.lastIndex = indx.last;
Adder.preLastIndex = indx.preLast;
})
.catch(error => new Sum.Error(error));
await Adder.getValuesStorage()
.addValue(new Sum.Float(3.14))
.then(indx => {
Adder.lastIndex = indx.last;
Adder.preLastIndex = indx.preLast;
})
.catch(error => new Sum.Error(error))
const SumManager = new Sum.Manager();
SumManager.setAdder(Adder);
SumManager.trySum()
.then(s => console.dir(new Sum.Result(s).toString()))
.catch(error => {
console.log(5 + 3.14)
});
})();