Skip to content
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

Better composability #4

Open
jstcki opened this issue Jun 22, 2014 · 1 comment
Open

Better composability #4

jstcki opened this issue Jun 22, 2014 · 1 comment

Comments

@jstcki
Copy link
Contributor

jstcki commented Jun 22, 2014

It would be nice if there were alternative Sprout functions which took the object as the last argument or even better created partially applied functions.

They could be named with the suffix 'With', similar like in allong.es.

For example:

var getName = sprout.getWith('name');
getName({name: 'foo'}); // => 'foo'
getName({name: 'bar'}); // => 'bar'
someArray.map(getName);
@anru
Copy link
Owner

anru commented Jun 22, 2019

Partial application should solve this issue in a language level, I think.

Also, probably better way is add examples how users could use currying to existing sprout methods.
Like this:

const { curryRight } = require('robust-and-already-exists-curry-library')

const getName = curryRight(sprout.get, 'name')

getName({name: 'foo'}) // => 'foo'
getName({name: 'bar'}) // => 'bar'
someArray.map(getName)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants