Skip to content

Instantly share code, notes, and snippets.

@markwithers
Last active February 21, 2018 09:43
Show Gist options
  • Save markwithers/c17f198e1c4551540788cc44d704d3bf to your computer and use it in GitHub Desktop.
Save markwithers/c17f198e1c4551540788cc44d704d3bf to your computer and use it in GitHub Desktop.
const r = require('ramda')
const lefts = r.reduce(
(memo, either) => {
let extract
either.bimap(x => extract = x, r.identity)
return extract ? r.append(extract, memo) : memo
},
[]
)
const rights = r.reduce(
(memo, either) => {
let extract
either.bimap(r.identity, x => extract = x)
return extract ? r.append(extract, memo) : memo
},
[]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment