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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added BigInt support #197
Added BigInt support #197
Conversation
@@ -214,6 +214,8 @@ function $asNull () { | |||
function $asInteger (i) { | |||
if (isLong && isLong(i)) { | |||
return i.toString() | |||
} else if (typeof i === 'bigint') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This library currently tests all the way back to Node 6 --
fast-json-stringify/azure-pipelines.yml
Lines 5 to 13 in 4b6df2e
matrix: | |
node_6_x: | |
node_version: 6.x | |
node_8_x: | |
node_version: 8.x | |
node_10_x: | |
node_version: 10.x | |
node_11_x: | |
node_version: 11.x |
What will this line do on < 10.13?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing, it's just a string comparison, which means that it will always be false.
Anyhow, we will drop Node v6 and v8 once we release Fastify v3 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know. But it still has to work for the versions this will actually target.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does, as you can see all the tests are passing :)
You can use the BigInt syntax only from Node 10.4 and above.
In any other case the typeof will return something else, so the if will never be true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
if (semver.gt(process.versions.node, '10.3.0')) { | ||
require('./bigint')(t.test, build) | ||
} else { | ||
t.pass('Skip because Node version < 10.4') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn鈥檛 there be at least one test here to show the behavior on old versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fear that I鈥檓 missing something. Can you propose a test?
As I said above, this is a good old typeof, which will work in any Node version.
In version ma older than 10.4 you can鈥檛 use the BigInt syntax.
As titled! 馃殌
Checklist
npm run test
andnpm run benchmark