Skip to content

Parse negative values for numeric parser types#79

Open
Jaksenc wants to merge 1 commit into
vercel:mainfrom
Jaksenc:codex/negative-number-parsers
Open

Parse negative values for numeric parser types#79
Jaksenc wants to merge 1 commit into
vercel:mainfrom
Jaksenc:codex/negative-number-parsers

Conversation

@Jaksenc
Copy link
Copy Markdown

@Jaksenc Jaksenc commented May 14, 2026

Summary

  • recognize parseInt and parseFloat as numeric parser types when deciding whether a required option may consume a following negative-looking value
  • carry the same numeric metadata through array parser specs, so [Number] and [parseInt] handle separate negative values consistently
  • preserve strict option parsing for non-numeric-looking tokens such as -abc and for non-numeric option types such as String

This keeps the existing negative-number exception narrow instead of making every required option consume the next dash-prefixed token.

Fixes #52.

Verification

  • npm test
  • npx prettier --check index.js test.js
  • git diff --check
  • node --check index.js
  • npx -p node@20 node node_modules/jest/bin/jest.js --coverage -w 2

@Jaksenc Jaksenc marked this pull request as ready for review May 18, 2026 13:19
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.

Issues parsing negative numbers when passed without =

1 participant