Function consumeSync

  • Consumes an input sync iterable and optionally applies a mapping function to each element. Returns an array containing the results of the mapping function.

    Returns

    A function that accepts an input sync iterable and returns an array containing the results.

    Example

    const input = [1, 2, 3];
    const double = (x: number) => x * 2;
    const consumedSyncIterable = consumeSync<number, number>(double)(input);
    console.log(consumedSyncIterable); // Logs [2, 4, 6]

    Remarks

    Available as consume when imported from peter-piper/sync.

    Type Parameters

    • T

      The type of elements in the input sync iterable.

    • U

      The type of elements in the resulting array.

    Parameters

    • Optional mapFn: MapFn<T, U>

      An optional mapping function to apply to each element of the input sync iterable.

    Returns ((input: Iterable<T>) => U[])

      • (input: Iterable<T>): U[]
      • Parameters

        • input: Iterable<T>

        Returns U[]

Generated using TypeDoc