-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: add genObjectFromValues
#9
Conversation
wdyt @danielroe, @pi0 ? |
Thanks for the PR @ricardogobbosouza. I believe this had to be default behavior preserving types for serialization. /cc @danielroe Any reason why not to make default? |
@pi0 I didn't put it as default because this is a breaking change |
Maybe rename to |
I'm fine with breaking change if necessary. We do it quite often for unjs packages. Only want to ensure we have the same vision about utility behavior. |
The major purpose of this utility is in order to render strings as 'raw', allowing functions, and other non serialisable values, to be serialised. I would suggest JSON.stringify or, if that doesn't work for your use, a different utility (genObject) with more information on why it's needed. |
The main purpose of this package was to render valid JS code. But I'm fine if by convention left values are considered to be JS code we could simply use Having |
It makes more sense to have another function like |
preserveString
valuesgenObjectFromValues
@pi0, @danielroe |
@pi0, @danielroe Any idea when it will be merged? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9 +/- ##
==========================================
+ Coverage 97.36% 98.75% +1.38%
==========================================
Files 7 7
Lines 380 402 +22
Branches 72 77 +5
==========================================
+ Hits 370 397 +27
+ Misses 10 5 -5 ☔ View full report in Codecov by Sentry. |
Sometimes it is necessary to generate an object preserving types