microsoft / microsoft/node-jsonc-parser

Feature request: Support (optional) bigint during parsing

Open
#95 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
759
Forks
66
Avg merge
5d 10h
Merged PRs (30d)
7

Description

Currently, number literal will be parsed by the following code:

https://github.com/microsoft/node-jsonc-parser/blob/3c9b4203d663061d87d4d34dd0004690aef94db5/src/impl/parser.ts#L515-L519

It would be better to add a feature that allow detecting the number and parsing it with BigInt, like:

// -9007199254740991 ~ 9007199254740991
// More precise checking could be used, here's only a demo
if (/^-?\d{16,}$/.test(tokenValue)) {
  value = BigInt(tokenValue)
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/impl/parser.ts around lines 515-519, where number literals are currently parsed. Trace how parsed values are exposed and determine where an optional bigint behavior could be configured. Done means large integer literals can be parsed with BigInt when requested without changing default parsing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.