-
Notifications
You must be signed in to change notification settings - Fork 68
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
More performant compact map #344
base: master
Are you sure you want to change the base?
Conversation
dubiousdavid
commented
Feb 21, 2022
- More performant compact map.
- Fix stuff Babel was complaining about.
…re/futil-js into feature/performant-compactMap
export let compactMap = _.curry((fn, collection) => | ||
_.flow(_.map(fn), _.compact)(collection) | ||
) | ||
export let compactMap = _.curry((iteratee, collection) => { |
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.
Can we do a quick benchmark? Lodash supports shortcut fusion which should be effectively the same thing. My first feedback was gonna be to do this with transducers https://runkit.com/daedalus28/transducer-example but lodash does this automatically in some cases - might only be only explicit chain
calls though.
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.
Fusion is only supported in the chain scenario. https://lodash.com/docs/4.17.15#lodash