-
Notifications
You must be signed in to change notification settings - Fork 663
feat(ini): reviver value is type casted #6887
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6887 +/- ##
=======================================
Coverage 94.11% 94.11%
=======================================
Files 581 581
Lines 42707 42708 +1
Branches 6796 6797 +1
=======================================
+ Hits 40194 40196 +2
+ Misses 2463 2462 -1
Partials 50 50 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ini/parse.ts
Outdated
| } | ||
|
|
||
| const QUOTED_VALUE_REGEXP = /^"(?<value>.*)"$/; | ||
| function defaultReviver(_key: string, value: string, _section?: string) { |
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.
| function parseValue(_key: string, value: string) { |
ini/parse.ts
Outdated
| } | ||
|
|
||
| const val = reviver(key, value, sectionName); | ||
| const parsedValue = defaultReviver(key, value, sectionName); |
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.
| const parsedValue = defaultReviver(key, value, sectionName); | |
| let parsedValue = parseValue(key, value); |
ini/parse.ts
Outdated
| const val = options.reviver | ||
| ? options.reviver(key, parsedValue, sectionName) | ||
| : parsedValue; |
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.
| const val = options.reviver | |
| ? options.reviver(key, parsedValue, sectionName) | |
| : parsedValue; | |
| if (options.reviver) parsedValue = options.reviver(key, parsedValue, sectionName); |
ini/parse_test.ts
Outdated
| const json = '{ "a": 100, "b": true, "c": null, "d": "foo" }'; | ||
| const parsedJson = JSON.parse(json, (_key, value) => value); | ||
| assertEquals(parsedJson, expected); |
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 don't think we need to run JSON version here
Closes #6884