-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
nf
seems to have wrong prototypes
#6994
Comments
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms. Thank you! |
Hey, I am intrested in this isssue. As you said here.
did you meant that left can be undefined because that will make more sense if i am not wrong. |
I can be wrong in this but i think |
Most appropriate sub-area of p5.js?
p5.js version
main branch
Web browser and version
No response
Operating system
No response
Steps to reproduce this
This is generally a report about the documentation and test cases.
From the reference, the prototypes for
nf
are:nf(num, [left], [right])
nf(nums, [left], [right])
However, from the source code, especially in
doNf(num, left, right)
, there isn't check oftype left === 'undefined'
, nor a default value forleft
, so when callingleftPart = leftPart.padStart(left, '0')
,left
cannot beundefined
.Also in the test suite of
p5.prototype.nf
, test cases are missing:result = nf(1234)
, ifleft
is optionalresult = nf([1234, 3.141516, 3.141516e-2], 2)
for an array of numbers to formatThe text was updated successfully, but these errors were encountered: