What Is Nemathode?
Nemathode is array based mathematical expression notation (further in the text: nematode/s, expression/s).
What is the purpose of this?
Sometimes we have to change math core on the fly but keep all the API differences outside of our attention. Refactoring process is slow, tedious, and error prone so.
With Nemathode we can
- use whole bunch of libs and configure them them “under one roof”
- add new methods, operators, constants and choose naming for them
- calibrate computation accuracy on the fly by
- changing already declared method implementations
- replacing math constants with more suitable values
What Is Nemathode.js?
Examples of using
Configuration example (pure js)
You can view this and more other examples of configurations here
Literally, mathematical constants
Set of records with implementations
It seems excessive but not everyone using pure js functionality. There are set of libraries where intermediate type is not a number, for example: bignumber.js, decimal.js etc (we have on our website set of configs for most popular libs). So you can configure entry handler for them like
Opposite of toInputType. See at an example
Let’s look at one of examples
It’s a configuration for operator that consists from two (by now) fields: precedence, implementation (the same as in functions).
Api — standart
Api — with love ❤️
- stackoverflow post about some task with similar syntax
- a few tasks in codewars (couldn’t find it unfortunately)
- math.js library and it’s evaluation mechanism
- Full TS coverage
- Unary operands (still thinking, need your opinion)
- Function arguments evaluation
- Overcome limitations with different return types: number, boolean
A few last words
Have a nice coding or nemathoding)