Skip to content

Instantly share code, notes, and snippets.

@MarcoWorms
Created April 5, 2018 06:14
Show Gist options
  • Save MarcoWorms/a51c61a8511fc8e9d10fe9f04bbe9b6b to your computer and use it in GitHub Desktop.
Save MarcoWorms/a51c61a8511fc8e9d10fe9f04bbe9b6b to your computer and use it in GitHub Desktop.
// http://ramdajs.com/docs/#pipe
const { pipe, curry } = require('ramda')
const addToTop = curry((card, deck) => [card, ...deck])
const addToBottom = curry((card, deck) => [...deck, card])
const addBoth = pipe(
addToTop({ name: 'Ice Wall', damage: 3, cost: 1 }),
addToBottom({ name: 'Earth Strike', damage: 6, cost: 3 })
)
const newDeck = addBoth(deck)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment