Object Oriented Programming vs. Functional Programming: Best Of Both Worlds
Victor Nwaokocha
132

Thanks for the post.

In my opinion one huge benefit of currying is that it allows you to be explicit without too much effort. Consider rewriting your last code block like this:

const get = curry((property, object) => object[property])
const getName = get('name')
const names = people.map(getName)

The code is longer but the last line is easier to read: you’re mapping on people and getting their names. Also, you now have a handy getName function that will return the name property from any object. Have a dog object?

const dog = { name: 'Snoopy', age: 6 }
getName(dog)

So, thanks to currying, you can create many small functions, that are easy to reason about, and compose them together. In case you’re interested I wrote a little about it here.