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

What about throwing for invalid input? #195

Open
safareli opened this issue Aug 10, 2018 · 1 comment
Open

What about throwing for invalid input? #195

safareli opened this issue Aug 10, 2018 · 1 comment

Comments

@safareli
Copy link

safareli commented Aug 10, 2018

Maybe provide "safe" constructor which checks if input is valid first, or something other then returning invalid values like this:

> var BN = require('bn.js');
> (new BN("10", 10)).toString(10)
'10'
> (new BN("asdads", 10)).toString(10)
'1294158'
> (new BN("-----bla", 10)).toString(10)
'--3331680'
> (new BN("!@#!@#@!#!@-----bla", 10)).toString(10)
'-135390-533285undefined-2452320'
> (new BN("-135390-533285undefined-2452320", 10)).toString(10)
'-135389753328824457045272452320'
@therightstuff
Copy link

therightstuff commented Aug 29, 2018

@indutny @dcousens This issue has been resolved for a while, could you please create a new release that includes the fix?

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

No branches or pull requests

2 participants