image2text

Untitled

Jul 25th, 2019
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. const pluckDeep = key => obj => key.split('.').reduce((accum, key) => accum[key], obj)
  2. const compose = (...fns) => res => fns.reduce((accum, next) => next(accum), res)
  3. const unfold = (f, seed) => {
  4. const go = (f, seed, acc) => {
  5. const res = f(seed)
  6. return res ? go(f, res[1], acc.concat([res[0]])) : acc
  7. }
  8. return go(f, seed, [])
  9. }
Advertisement
Add Comment
Please, Sign In to add comment