pnpm
Version:
Fast, disk space efficient package manager
21 lines (18 loc) • 756 B
JavaScript
/** @license MIT License (c) copyright 2010-2016 original author or authors */
/** @author Brian Cavalier */
/** @author John Hann */
import { mergeMapConcurrently } from './mergeConcurrently'
/**
* Map each value in stream to a new stream, and concatenate them all
* stream: -a---b---cX
* f(a): 1-1-1-1X
* f(b): -2-2-2-2X
* f(c): -3-3-3-3X
* stream.concatMap(f): -1-1-1-1-2-2-2-2-3-3-3-3X
* @param {function(x:*):Stream} f function to map each value to a stream
* @param {Stream} stream
* @returns {Stream} new stream containing all events from each stream returned by f
*/
export function concatMap (f, stream) {
return mergeMapConcurrently(f, 1, stream)
}