/** * Filters the `ImmutableArray` and maps the output using the specified * function. * * @tsplus static ImmutableArray.Aspects collect * @tsplus pipeable ImmutableArray collect */ export function collect(f: (a: A) => Maybe) { return (self: ImmutableArray): ImmutableArray => self.collectWithIndex((_, a) => f(a)) }