Package: effect
Module: Array
Maps each element with a nullable-returning function, keeping only non-null / non-undefined results.
When to use
Use when you need to map and filter in one step, where the mapper can return
null or undefined to skip elements.
Example (Flat mapping with nullable values)
import { Array } from "effect"
console.log(Array.flatMapNullishOr([1, 2, 3], (n) => (n % 2 === 0 ? null : n)))
// [1, 3]
See
flatMap for mapping each element to an array and flatteningfromNullishOr for converting a single nullable value to an arraySignature
declare const flatMapNullishOr: { <A, B>(f: (a: A) => B): (self: ReadonlyArray<A>) => Array<NonNullable<B>>; <A, B>(self: ReadonlyArray<A>, f: (a: A) => B): Array<NonNullable<B>>; }
Since v4.0.0