-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Fixes GH-17399 #17747
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
Merged
Merged
Fixes GH-17399 #17747
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c6fba55
Fixes GH-17399
dannyroosevelt 679ab02
Update pnpm-lock.yaml
dannyroosevelt 68e599c
Update pnpm-lock.yaml
dannyroosevelt 7fa33d9
Update pnpm-lock.yaml
dannyroosevelt 25acc0c
Merge branch 'master' into danny/connect-react/gh-17399
dannyroosevelt 0dea0ed
Linting
dannyroosevelt 5e13bfb
Merge branch 'danny/connect-react/gh-17399' of github.com:PipedreamHQ…
dannyroosevelt 7c6155b
Merge branch 'danny/connect-react/gh-17399' of github.com:PipedreamHQ…
dannyroosevelt 8a02075
Linting and documenting the utility functions
dannyroosevelt b76c99a
Merge branch 'master' into danny/connect-react/gh-17399
dannyroosevelt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
dannyroosevelt marked this conversation as resolved.
Show resolved
Hide resolved
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| export interface OptionWithValue { | ||
| value: string | number; | ||
| label?: string; | ||
| __lv?: any; | ||
| } | ||
|
|
||
| export function isString(value: unknown): value is string { | ||
| return typeof value === 'string'; | ||
| } | ||
|
|
||
| export function isOptionWithValue(value: unknown): value is OptionWithValue { | ||
| return ( | ||
| value !== null && | ||
| typeof value === 'object' && | ||
| !Array.isArray(value) && | ||
| 'value' in value | ||
| ); | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| export function isStringArray(value: unknown): value is string[] { | ||
| return Array.isArray(value) && value.every(item => typeof item === 'string'); | ||
| } | ||
|
|
||
| export function isOptionArray(value: unknown): value is OptionWithValue[] { | ||
| return Array.isArray(value) && value.every(item => isOptionWithValue(item)); | ||
| } | ||
|
|
||
| export function normalizeOption(option: unknown): OptionWithValue | string { | ||
| if (isString(option)) { | ||
| return option; | ||
| } | ||
| if (isOptionWithValue(option)) { | ||
| return option; | ||
| } | ||
| return String(option); | ||
| } | ||
dannyroosevelt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| export function normalizeOptions(options: unknown): Array<OptionWithValue | string> { | ||
| if (!Array.isArray(options)) { | ||
| return []; | ||
| } | ||
| return options.map(normalizeOption); | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.