Skip to content

Conversation

@rdmurphy
Copy link
Contributor

@rdmurphy rdmurphy commented Jan 4, 2022

Closes #175.

I used the more complex check of Object.prototype.toString.call(val) === '[object BigInt]' instead of just doing typeof val === 'bigint' to account for anyone doing something absurd like Object(2n) or Object(BigInt(3) just to cover all the bases.

Also may kinda smell that this is happening within circular(), but I didn't want to do anything more expansive than that. 😅

I followed the lead of MDN and used toString() as the JSON-friendly output. When you run console.log on a BigInt it prints it with a trailing n to signify it is a special value. I could maybe see doing that instead for clarity? They'd still have to be a string though so the effect isn't entirely the same.

["1", "2", "3", "4"]
// vs.
["1n", "2n", "3n", "4n"]

@codecov-commenter
Copy link

codecov-commenter commented Jul 3, 2022

Codecov Report

Merging #186 (9eeaa98) into master (0761ef9) will decrease coverage by 0.60%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #186      +/-   ##
==========================================
- Coverage   89.48%   88.88%   -0.61%     
==========================================
  Files           4        3       -1     
  Lines         333      306      -27     
==========================================
- Hits          298      272      -26     
+ Misses         35       34       -1     
Impacted Files Coverage Δ
src/diff.js 98.40% <100.00%> (+0.01%) ⬆️
src/parse.js
src/index.js 75.49% <0.00%> (+0.24%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0761ef9...9eeaa98. Read the comment docs.

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.

feature request: support bigint in assert.equal

3 participants