Skip to content

Instantly share code, notes, and snippets.

@BnayaZil
Created June 3, 2017 20:39
Show Gist options
  • Save BnayaZil/30465de449780199e33da9b3dde82303 to your computer and use it in GitHub Desktop.
Save BnayaZil/30465de449780199e33da9b3dde82303 to your computer and use it in GitHub Desktop.
Ramda series
import {prop, compose} from 'ramda'
const player = {
id: 1,
name: 'Bnaya',
file: {
img: 'http://foo.bar/bnaya-zil.png',
thumb: 'http://foo.bar/bnaya-zil-thumb.png'
}
}
const getFile = prop('file')
const getThumb = prop('thumb')
const getPlayerPicture = compose(getThumb, getFile)
const playerPicture = getPlayerPicture(player) // returns: 'http://foo.bar/bnaya-zil-thumb.png'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment