Skip to content

fix(ini): parse empty unquoted value as empty string - #7378

Open
helmipradita wants to merge 1 commit into
denoland:mainfrom
helmipradita:fix/ini-empty-unquoted-value
Open

helmipradita wants to merge 1 commit into
denoland:mainfrom
helmipradita:fix/ini-empty-unquoted-value

Conversation

@helmipradita

Copy link
Copy Markdown

Fixes #7377.

Description

In @std/ini, parseValue() in ini/parse.ts previously evaluated if (!isNaN(+value)) return +value;. In JavaScript, +"" === 0, causing an empty unquoted value (such as k= or k = ) to be parsed as the number 0 instead of "". This also broke round-trips with stringify() (which produces k=).

Changes

  1. Gated numeric parsing in ini/parse.ts with value !== "" && !isNaN(+value).
  2. Added unit tests in ini/parse_test.ts for unquoted empty values (k= and k = ).

@github-actions github-actions Bot added the ini label Nov 6, 2026
@codecov

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.02%. Comparing base (f834d02) to head (c08d9d3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7378      +/-   ##
==========================================
- Coverage   95.04%   95.02%   -0.02%     
==========================================
  Files         619      619              
  Lines       52012    51760     -252     
  Branches     9450     9403      -47     
==========================================
- Hits        49434    49187     -247     
+ Misses       2031     2022       -9     
- Partials      547      551       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@helmipradita

Copy link
Copy Markdown
Author

All 4 required checks are green on c08d9d3 (plus full v1/v2 test matrix, lint, wasm, Codecov) and the PR is CLEAN/MERGEABLE. Open since 2026-11-06 with no reviews or reviewers assigned. @kt3k could you take a look when you get a chance? Happy to address any feedback.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@std/ini parse() returns 0 for an empty unquoted value instead of an empty string

1 participant