fix issue 210: custom values formatting schema#249
Closed
MaxDonchenko wants to merge 8 commits intosindresorhus:masterfrom
Closed
fix issue 210: custom values formatting schema#249MaxDonchenko wants to merge 8 commits intosindresorhus:masterfrom
MaxDonchenko wants to merge 8 commits intosindresorhus:masterfrom
Conversation
MaxDonchenko
commented
Mar 2, 2020
| return ret; | ||
| } | ||
|
|
||
| return (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce((result, key) => { |
Author
There was a problem hiding this comment.
Too much logic in the return statement makes it hard to understand what's actually returned from the function.
sindresorhus
requested changes
Mar 2, 2020
| if (typeof typedSchemaFormatter === 'function') { | ||
| return typedSchemaFormatter; | ||
| } | ||
|
|
Owner
There was a problem hiding this comment.
It should throw if the typedSchemaFormatter type is not a supported type.
| baz: 3 | ||
| }; | ||
| t.deepEqual(actual, expected); | ||
| }); |
Owner
There was a problem hiding this comment.
This feature will need a lot more tests.
| ``` | ||
| */ | ||
| readonly types?: { | ||
| [key: string]: 'string' | 'number' | CustomValueParser; |
Owner
There was a problem hiding this comment.
Suggested change
| [key: string]: 'string' | 'number' | CustomValueParser; | |
| [type: string]: 'string' | 'number' | CustomValueParser; |
| queryString.parse('foo=1&bar=1&baz=1.5', { | ||
| types: { | ||
| foo: 'string', | ||
| bar: 'number', |
Owner
There was a problem hiding this comment.
What about an array of string or array of numbers? We should probably use the notation string[] and number[] for those.
Co-Authored-By: Sindre Sorhus <[email protected]>
Co-Authored-By: Sindre Sorhus <[email protected]>
Author
|
Sorry, I've just realized unfortunately I have no spare time to finish the PR. If someone is willing to finish - it'd cool to finally deliver this functionality. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #210