-
Notifications
You must be signed in to change notification settings - Fork 2
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(map,filter): additional arguments #326
base: master
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 777ce53 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #326 +/- ##
==========================================
+ Coverage 85.30% 85.77% +0.47%
==========================================
Files 177 177
Lines 7411 7418 +7
Branches 241 241
==========================================
+ Hits 6322 6363 +41
+ Misses 1087 1055 -32
+ Partials 2 0 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
}, | ||
}) | ||
|
||
const prependPrefix = (chunk, prefix) => prefix + chunk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the additional variadic argument is not needed using partial application:
const prependPrefix = prefix => chunk => prefix + chunk
const outStream = input.pipe(map.call(context, prependPrefix('foo_')))
But expressing partial application as code snippets b59 turtle files is more cumbersome, so probably the variadic arg solution is the best option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an intriguing idea but I agree that the turtle representation would likely be more complicated
I extended the
map
andfilter
steps with the option to pass any number of additional parameters for the callbacks.Until now, to parametrise them, one required to use and access the variables. It should now be easier to achieve the same result.
For example, to filter only chunks which are greater than X