25 lines
881 B
JavaScript
25 lines
881 B
JavaScript
|
'use strict';
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports.concatMap = concatMap;
|
||
|
|
||
|
var _mergeConcurrently = require('./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
|
||
|
*/
|
||
|
function concatMap(f, stream) {
|
||
|
return (0, _mergeConcurrently.mergeMapConcurrently)(f, 1, stream);
|
||
|
} /** @license MIT License (c) copyright 2010-2016 original author or authors */
|
||
|
/** @author Brian Cavalier */
|
||
|
/** @author John Hann */
|