Skip to content

Instantly share code, notes, and snippets.

@IsTheJack
Created August 30, 2018 13:16
Show Gist options
  • Save IsTheJack/1b7c5f15b1ca89e92fde5a84e516f4da to your computer and use it in GitHub Desktop.
Save IsTheJack/1b7c5f15b1ca89e92fde5a84e516f4da to your computer and use it in GitHub Desktop.
Dado o código. Para obter o resultado de saída esperado (linha 13), qual método de composição eu devo utilizar no lugar da função 'X' (linha 11)? Opções (compose e pipe)
import { compose, pipe } from 'ramda'
const ada = { name: 'Ada Lovelace', age: 36 }
// getNameProp :: Object -> String
const getNameProp = obj => obj.name
// toThank :: String -> String
const toThank = name => `Thank you, ${name}!`
const toThankPerson = X(toThank, getNameProp)
console.log(toThankPerson(ada)) // => Thank you, Ada Lovelace!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment