Skip to content

Instantly share code, notes, and snippets.

@krzysztofczernek
Created September 24, 2019 19:37
Show Gist options
  • Save krzysztofczernek/22393455e54d69ad6668fe35b821789c to your computer and use it in GitHub Desktop.
Save krzysztofczernek/22393455e54d69ad6668fe35b821789c to your computer and use it in GitHub Desktop.
// A version with explicit references to arguments
const getLastUserDisplayName = () => {
return getAllUsers()
.then(users => R.last(users))
.then(lastUser => lastUser.firstName)
.then(firstName => R.toUpper)
}
// A point-free equivalent
const getLastUserDisplayName = () => {
return getAllUsers()
.then(R.last)
.then(R.prop('firstName'))
.then(R.toUpper)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment