• Takes an array of values, flattening to a single one using the provided reducer function.

    // Create a chain that flattens values
    const reduce = Chains.reduce(values => Math.max(...values));
    // Feed it a single input (an array), get a single output back:
    const result = await Chains.single(reduce, [ 1, 2, 3]); // 3

    Type Parameters

    • In
    • Out

    Parameters

    • reducer: ((v: In[]) => Out)

      Function to reduce array of values to a single value

    Returns Link<In[], Out>