• Returns a Stream that yields elements from the source transformed by the mapper.

    Type Parameters

    • T

      Type of items in the source.

    • O

      Type of items in the result.

    Parameters

    • mapper: ((value: T, index: number) => O)

      Function to transform elements.

        • (value, index): O
        • Parameters

          • value: T
          • index: number

          Returns O

    Returns OperationFunction<T, O>

    Operation that yields elements from the source transformed by the mapper.

    const result = map((x) => x * 2)([1, 2, 3]);
    console.log([...result]); // [2, 4, 6]