Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

len function added, round has second parameter #34

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

escopecz
Copy link
Contributor

  1. len function added. Inspiration is from MS Excel LEN function.
  2. 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 * exp because 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.

@johannesschobel
Copy link

looks good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants