find

fun <T> find(    fn: (data: Any?, options: ArrayOptions?) -> Boolean,     options: ArrayOptions = definedExternally): <Error class: unknown class><T?>(source)

This method is similar to Array.prototype.find and calls fn on each chunk in the stream to find a chunk with a truthy value for fn. Once an fn call's awaited return value is truthy, the stream is destroyed and the promise is fulfilled with value for which fn returned a truthy value. If all of the fn calls on the chunks return a falsy value, the promise is fulfilled with undefined.

Since

v17.5.0

Parameters

fn

a function to call on each chunk of the stream. Async or not.


fun find(    fn: (data: Any?, options: ArrayOptions?) -> <Error class: unknown class><Boolean>,     options: ArrayOptions = definedExternally): <Error class: unknown class><Any?>(source)