Published
Edited
Jan 16, 2021
1 fork
6 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
sortedPhones = users => chain(users)
.sortBy(user => user.signup_date)
.map(user => user.phone)
.value()
Insert cell
md`Let’s also make a handy \`dot\` function that returns the property of an object.`
Insert cell
dot = curry((prop, obj) => obj[prop])
Insert cell
md`
You can now create \`sortedPhone2\` that:
* gets rid of the wrapping and unwrapping and all of the extra fluff;
* boils it down to the essential parts, making it more understandable and maintainable;
* makes it completely data generic.
`
Insert cell
sortedPhones2 = compose(
map(dot("phone")),
R.sortBy(dot("signup_date"))
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more