1. 8
    Build a Functional Pipeline with Ramda.js
    5m 37s

Build a Functional Pipeline with Ramda.js

Andy Van Slaars
InstructorAndy Van Slaars

Share this video with your friends

Send Tweet

We'll learn how to take advantage of Ramda's automatic function currying and data-last argument order to combine a series of pure functions into a left-to-right composition, or pipeline, with Ramda's pipe function.

Charles
Charles
~ 4 years ago

the code in CODE TAB does not reflect what the presenter in the video was teaching. Is there a reason why/

Andy Van Slaars
Andy Van Slaarsinstructor
~ 4 years ago

Charles,

First of all, thanks for watching!

The code in the code tab does have a couple of slight differences, but the core result of the lesson is represented. The key differences are that in the video, I am running the code with Node and use a require to import the library. In the embedded example, Ramda is being pulled into the browser through a script tag.

The second difference is that there is an additional line at the bottom of the code sample, simply for the purpose of showing the results in the result pane rather than forcing you to open your console.

The third difference is that the commented out version of the code has been removed from the embedded example for clarity.

I hope this helps and thanks again for watching!

Sen P
Sen P
~ 4 years ago

Slightly concise version using reduce.

const findTopTeam = R.reduce((a,b) => a.score > b.score ? a : b, {score: 0})
const getName = R.prop('name')
const getTopName = R.pipe(findTopTeam, getName)
Andy Van Slaars
Andy Van Slaarsinstructor
~ 4 years ago

Sen,

Nice optimization!