Function oneOfMany

  • Just like oneOf but you have to specify the type parameter. Example: oneOfMany<TYPEPARAM>.

    Example

    The type inference is a bit worse on this function. In most cases you will have to specify the type parameter yourself.

    const json: Parser<Json> = P.oneOfMany<Json>(
    P.float.map(JNumber),
    P.keyword("true").map(() => JBoolean(true)),
    P.keyword("false").map(() => JBoolean(false)),
    P.keyword("null").map(() => JNull)

    See

    • oneOf like oneOfMany but with different type inference.

    Type Parameters

    • A

    Parameters

    Returns Simple.Parser<A>