• Chains eithers, where it returns out a Left if one of the composed functions returns left. Or return the Right value if all succeedes with the composed value from the last chain computation.

    Example

    const validate = (str: string) =>
    str === 'correct' ? right(1) : left(new Error('string has to be "correct"'))

    chain(validate, right('correct'))
    .unrightOr(throws) // -> 1

    chain(validate, left('error'))
    .unrightOr(throws) // -> throws error

    ```

    Type Parameters

    • L

    • R

    • B

    Parameters

    Returns Either<L, B>

Generated using TypeDoc