(f: (data: T) => O)
| 30 | * @param f - The function to apply to each element |
| 31 | */ |
| 32 | export function map<T, O>(f: (data: T) => O): PipedOperator<T, O> { |
| 33 | return (stream: IStreamBuilder<T>): IStreamBuilder<O> => { |
| 34 | const output = new StreamBuilder<O>( |
| 35 | stream.graph, |
| 36 | new DifferenceStreamWriter<O>(), |
| 37 | ) |
| 38 | const operator = new MapOperator<T, O>( |
| 39 | stream.graph.getNextOperatorId(), |
| 40 | stream.connectReader(), |
| 41 | output.writer, |
| 42 | f, |
| 43 | ) |
| 44 | stream.graph.addOperator(operator) |
| 45 | return output |
| 46 | } |
| 47 | } |
no test coverage detected