Mathx
Mathx is a library that represents a mathematical equation as a graph of dependencies. It uses the Mobx library to make properties observable.
Read the docs
Install
$ npm install --save mathx
or
$ yarn add mathx
Basic Usage
; ; // Add an equation to the calc; // This function will run once, immediately, then any time the value of `a` changesautorun;// => The value of a = 10 a.setFormula'5';// => The value of a = 5 // Let's add another equation to the calc, this one will be dependent on the value of `a`; // setup another autorun function that observes `b`autorun;// => The value of b = 10 a.setFormula'10';// => The value of b = 15// => The value of a = 10 // The autorun function is called again, because the value of `b` depends on the value of `a`.
You can learn more by reading the documentation
Run the tests
clone the repo
$ git clone https://github.com/trevorhanus/mathx.git
install node modules
$ npm install
or
$ yarn install
run the all the tests
$ npm test
run one test individually
$ mocha --reporter spec --compilers ts:ts-node/register ./test/path/to/file.test.ts