chore(dev): getInputList helper func#46
Merged
marcosnils merged 1 commit intodagger:mainfrom Apr 12, 2022
Merged
Conversation
marcosnils
reviewed
Apr 12, 2022
joaofnds
approved these changes
Apr 12, 2022
Comment on lines
+22
to
+32
| const items = core.getInput(name); | ||
| if (items == '') { | ||
| return []; | ||
| } | ||
| return items | ||
| .split(/\r?\n/) | ||
| .filter(x => x) | ||
| .reduce<string[]>( | ||
| (acc, line) => acc.concat(!ignoreComma ? line.split(',').filter(x => x) : line).map(pat => pat.trim()), | ||
| [] | ||
| ); |
Contributor
There was a problem hiding this comment.
Suggested change
| const items = core.getInput(name); | |
| if (items == '') { | |
| return []; | |
| } | |
| return items | |
| .split(/\r?\n/) | |
| .filter(x => x) | |
| .reduce<string[]>( | |
| (acc, line) => acc.concat(!ignoreComma ? line.split(',').filter(x => x) : line).map(pat => pat.trim()), | |
| [] | |
| ); | |
| const items = core.getInput(name); | |
| if (items == '') { | |
| return []; | |
| } | |
| let splitCharSet = '\r\n' | |
| if (!ignoreComma) splitCharSet += ',' | |
| return items | |
| .split(new RegExp(`[${splitCharSet}]`)) | |
| .filter(x => x) | |
| .map(pat => pat.trim()); |
2da3d0a to
f0109be
Compare
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
f0109be to
d0d5d21
Compare
Codecov Report
@@ Coverage Diff @@
## main #46 +/- ##
==========================================
- Coverage 94.59% 90.00% -4.60%
==========================================
Files 1 2 +1
Lines 37 50 +13
Branches 7 9 +2
==========================================
+ Hits 35 45 +10
- Misses 1 3 +2
- Partials 1 2 +1
Continue to review full report at Codecov.
|
marcosnils
approved these changes
Apr 12, 2022
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.
follow-up #44 (comment)
Adds
getInputListfunc. I don't use the getMultilineInput from the core module because because it lacks some sanitizing logic and also doesn't handle comma delimiter that could be useful in the future.Also adds
asyncForEachso you could iterate over this list for the multiargsfeature we talked about.cc @marcosnils @joaofnds
Signed-off-by: CrazyMax crazy-max@users.noreply.github.com