FuncType - v0.8.85
    Preparing search index...

    Interface ContainerOps<A>

    Universal operations that work on any container (single-value or collection). These operations make sense for Option, Either, Try, List, Set, etc.

    interface ContainerOps<A extends Type> {
        count(p: (x: A) => boolean): number;
        exists(p: (a: A) => boolean): boolean;
        find(p: (a: A) => boolean): Option<A>;
        forEach(f: (a: A) => void): void;
    }

    Type Parameters

    • A extends Type

      The type of value(s) in the container

    Hierarchy (View Summary)

    Index

    Methods

    • Counts elements that satisfy the predicate. For single-value containers: returns 0 or 1 For collections: returns the count of matching elements

      Parameters

      • p: (x: A) => boolean

      Returns number

    • Tests whether any element satisfies the predicate. For single-value containers: tests the single value For collections: returns true if any element matches

      Parameters

      • p: (a: A) => boolean

      Returns boolean

    • Finds the first element that satisfies the predicate. For single-value containers: returns Some(value) if predicate matches, None otherwise For collections: returns the first matching element wrapped in Option

      Parameters

      • p: (a: A) => boolean

      Returns Option<A>

    • Applies an effect function to each element. For single-value containers: applies to the value if present For collections: applies to each element

      Parameters

      • f: (a: A) => void

      Returns void