expr-eval
expr-eval copied to clipboard
len function added, round has second parameter
- len function added. Inspiration is from MS Excel LEN function.
- round takes a second parameter the same as MS Excel's ROUND function does. Implementation was inspired by Decimal Rounding function by Mozilla with one exception. The exp is
-1 * expbecause it behaved the opposite than the MS round function and TBH it wasn't logical.
I had fun time with function round(value, exp) {}. When I call it as round(1, 1), value = [1, 1] and exp = 'undefined. Couldn't found out why so I just played with it.
It will be easy to add floor(X, n) and ceil(X, n) as well (described in the Decimal Rounding link), but I'm in a hurry.
Tests are part of this PR, documentation updated.
looks good to me