• Compose an array of exactly 2 functions from bottom to top (right to left).

    Returns the fallback if x is null or undefined.

    Type Parameters

    • R2

    Parameters

    • fallback: R2

    Returns (<T, R1>(fns) => ((x) => R2))

      • <T, R1>(fns): ((x) => R2)
      • Type Parameters

        • T

        • R1

        Parameters

        Returns ((x) => R2)

          • (x): R2
          • Parameters

            • x: T

            Returns R2

    See

    compose3, compose4

    Example

    compose2('fallback')([y => y.toString(), x => x / 2])(42)
    // => "21"

    compose2('fallback')([y => y.toString(), x => x / 2])(undefined)
    // => "fallback"

Generated using TypeDoc