Skip to content

Instantly share code, notes, and snippets.

@Dafrok
Created August 23, 2017 09:21
Show Gist options
  • Select an option

  • Save Dafrok/d073ea792b39a2c01283e15cdb85ee9b to your computer and use it in GitHub Desktop.

Select an option

Save Dafrok/d073ea792b39a2c01283e15cdb85ee9b to your computer and use it in GitHub Desktop.
const flatten = (f =>
(x => f(y => x(x)(y)))
(x => f(y => x(x)(y)))
)(fn => data => data.reduce((ary, item) => ary.concat(item.length ? fn(item) : item), []))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment