Function zipToOptArray

  • Takes a tuple, wraps each element in Opt and applies appropriate Opt.zip function.

    Type Parameters

    • A

    • B

    Parameters

    • xs: readonly [A, B]

    Returns Opt<[WithoutOptValues<A>, WithoutOptValues<B>]>

    Example

    zipToOptArray([1, null, '', 7, false]) // None: Opt<[number, boolean, string, number, boolean]>
    zipToOptArray([1, true, '', 7, false]) // Some<[1, true, '', 7, false]>: Opt<[number, boolean, string, number, boolean]>

    Useful as a replacement to zip* functions when construction of Opts happens in parameters of the function.

    zipToOptArray([1, null, '', 7, false])
    // is same as
    zip5(opt(1), opt(null), opt(''), opt(7), opt(false))
  • Takes a tuple, wraps each element in Opt and applies appropriate Opt.zip function.

    Type Parameters

    • A

    • B

    • C

    Parameters

    • xs: readonly [A, B, C]

    Returns Opt<[WithoutOptValues<A>, WithoutOptValues<B>, WithoutOptValues<C>]>

    Example

    zipToOptArray([1, null, '', 7, false]) // None: Opt<[number, boolean, string, number, boolean]>
    zipToOptArray([1, true, '', 7, false]) // Some<[1, true, '', 7, false]>: Opt<[number, boolean, string, number, boolean]>

    Useful as a replacement to zip* functions when construction of Opts happens in parameters of the function.

    zipToOptArray([1, null, '', 7, false])
    // is same as
    zip5(opt(1), opt(null), opt(''), opt(7), opt(false))
  • Takes a tuple, wraps each element in Opt and applies appropriate Opt.zip function.

    Type Parameters

    • A

    • B

    • C

    • D

    Parameters

    • xs: readonly [A, B, C, D]

    Returns Opt<[WithoutOptValues<A>, WithoutOptValues<B>, WithoutOptValues<C>, WithoutOptValues<D>]>

    Example

    zipToOptArray([1, null, '', 7, false]) // None: Opt<[number, boolean, string, number, boolean]>
    zipToOptArray([1, true, '', 7, false]) // Some<[1, true, '', 7, false]>: Opt<[number, boolean, string, number, boolean]>

    Useful as a replacement to zip* functions when construction of Opts happens in parameters of the function.

    zipToOptArray([1, null, '', 7, false])
    // is same as
    zip5(opt(1), opt(null), opt(''), opt(7), opt(false))
  • Takes a tuple, wraps each element in Opt and applies appropriate Opt.zip function.

    Type Parameters

    • A

    • B

    • C

    • D

    • E

    Parameters

    • xs: readonly [A, B, C, D, E]

    Returns Opt<[WithoutOptValues<A>, WithoutOptValues<B>, WithoutOptValues<C>, WithoutOptValues<D>, WithoutOptValues<E>]>

    Example

    zipToOptArray([1, null, '', 7, false]) // None: Opt<[number, boolean, string, number, boolean]>
    zipToOptArray([1, true, '', 7, false]) // Some<[1, true, '', 7, false]>: Opt<[number, boolean, string, number, boolean]>

    Useful as a replacement to zip* functions when construction of Opts happens in parameters of the function.

    zipToOptArray([1, null, '', 7, false])
    // is same as
    zip5(opt(1), opt(null), opt(''), opt(7), opt(false))

Generated using TypeDoc