Skip to main content

match

Callable

  • match<InputValue, OutValue>(callback: (test: (predicate?: Predicate<InputValue, boolean>) => string) => Record<string, OutValue | Predicate<InputValue, OutValue>>): Predicate<InputValue, Out<OutValue>>

  • Returns a predicate function that matches against a set of input predicates.


    Type parameters

    • InputValue: Input
    • OutValue

    Parameters

    • callback: (test: (predicate?: Predicate<InputValue, boolean>) => string) => Record<string, OutValue | Predicate<InputValue, OutValue>>

      A function that accepts a test function and returns an object whose keys are the names of the predicates, and whose values are the corresponding predicate functions.

    Returns Predicate<InputValue, Out<OutValue>>

    A predicate function that returns the output of the matching predicate function or null if no predicates match.