Recursive fold takeWhile (as in haskell). Lazy evaluated!
- Iterates depth-first every element of a nested
data structure given as
obj
. - Runs only while the iterator
fn
returns true. - The
fn
iterator receives:- An accumulator, that by default is an array, but that can be defined as anything else in the third parameter given to foldWhile.
- The next value iterated.