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

Throws for BigInt #54

Open
brunnerh opened this issue Jul 25, 2019 · 3 comments
Open

Throws for BigInt #54

brunnerh opened this issue Jul 25, 2019 · 3 comments

Comments

@brunnerh
Copy link

brunnerh commented Jul 25, 2019

The function Number.isFinite returns false for all arguments of type bigint. So the formatting function throws immediately. It would be helpful if bigint would be supported as well. I would like to use it with Node's fs.stat, which now can return bigint values for file sizes.

(I tested how the function would behave without the check, and unfortunately the Math functions do not support bigint arguments: Cannot convert a BigInt value to a number at Math.log)

@sindresorhus
Copy link
Owner

PR welcome. For the one that wants to work on this, you need to update the readme, the TypeScript definitions, and add tests.

@niktekusho
Copy link

niktekusho commented Jul 30, 2019

PR welcome. For the one that wants to work on this, you need to update the readme, the TypeScript definitions, and add tests.

Since official support for BigInts in Node.js comes from v10.4.0 and at the moment support for it is not the best (what about Math functions?), should this be postponed at least until Node 8 goes EOL? (2019-12-31)

If not, should we use something along the lines of big-integer to provide support for them (which anyway doesn't solve the Math.log issue)?

@iansan5653
Copy link

iansan5653 commented Jan 7, 2020

Alternatively to waiting, just add { "engines" : { "node" : ">=10.4.0" } } to package.json for the new version.

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

No branches or pull requests

4 participants