function

lowk.iter.find

Signature

function lowk.iter.find<T>(
  fn: (item: T) => boolean
) -> function

Returns a function suitable for an iterator.

Consumes the iterator and returns the found item or nil.

Examples

print({11,22,33}
  | lowk.iter.fromarray
  | lowk.iter.find(function(n) return n%2 == 0 end))

-- 22