Skip to content

Instantly share code, notes, and snippets.

@clong365
Created April 18, 2018 02:34
Show Gist options
  • Select an option

  • Save clong365/7464a1921f549319368d071829b6a208 to your computer and use it in GitHub Desktop.

Select an option

Save clong365/7464a1921f549319368d071829b6a208 to your computer and use it in GitHub Desktop.
const pluckDeep = key => obj => key.split('.').reduce((accum, key) => accum[key], obj)
const compose = (...fns) => res => fns.reduce((accum, next) => next(accum), res)
const unfold = (f, seed) => {
const go = (f, seed, acc) => {
const res = f(seed)
return res ? go(f, res[1], acc.concat([res[0]])) : acc
}
return go(f, seed, [])
}
@chinoll
Copy link

chinoll commented Apr 29, 2018

test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment