You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an input structure where some numeric values are to be treated as strings. Rather than calling toString in multiple places in my code, I hoped to use the parsing options, but looking at the codebase I think it is not currently possible using either numberOptions or tagValueProcessor.
I see why there is no conversion - the input type is string and so is the output type, so when the tagValueProcessor is applied, parsing is not skipped.
I can't use the skipLike property of numberParseOptions because strnum only receives the value without the tag name for context. I can't safely use a regex to differentiate IDs from other numbers.
I can't use the parseTagValue option because that is a universal setting that can't be applied to specific tags.
I think the simplest (backward compatible) approach that would work for me, would be another option like parseTagValue, but which takes a function with the same inputs as tagValueProcessor or isArray, and returns boolean, so that enabling parsing can be finer grained.
Would you like to work on this issue?
Yes
No
Bookmark this repository for further updates. Visit SoloThought to know about recent features.
The text was updated successfully, but these errors were encountered:
We're glad you find this project helpful. We'll try to address this issue ASAP. You can vist https://solothought.com to know recent features. Don't forget to star this repo.
Description
I have an input structure where some numeric values are to be treated as strings. Rather than calling
toString
in multiple places in my code, I hoped to use the parsing options, but looking at the codebase I think it is not currently possible using either numberOptions or tagValueProcessor.Input
Code
Output
expected data
I see why there is no conversion - the input type is string and so is the output type, so when the tagValueProcessor is applied, parsing is not skipped.
I can't use the
skipLike
property ofnumberParseOptions
becausestrnum
only receives the value without the tag name for context. I can't safely use a regex to differentiate IDs from other numbers.I can't use the
parseTagValue
option because that is a universal setting that can't be applied to specific tags.I think the simplest (backward compatible) approach that would work for me, would be another option like parseTagValue, but which takes a function with the same inputs as tagValueProcessor or isArray, and returns boolean, so that enabling parsing can be finer grained.
Would you like to work on this issue?
Bookmark this repository for further updates. Visit SoloThought to know about recent features.
The text was updated successfully, but these errors were encountered: