dashkite / joy

The simplicity of Lodash with the functional flair of Rambda.
https://dashkite.github.io/joy/
Other
0 stars 0 forks source link

Iterable `any` #11

Open dyoder opened 1 year ago

dyoder commented 1 year ago

We have find but that's not quite the same.

Also, none of our iterable functions take an async function, including find.

We can just add generics for that case, ex:

any = generic name: "any"

generic any, isAsyncFunction, isIterable, ( p, it ) ->
  for i in it
    return true if await p i   
  false

generic any, isRegularFunction, isIterable, ( p, it ) ->
  for i in it
    return true if p i
  false
dyoder commented 1 year ago

Generics wouldn't work for ordinary functions that return a promise.