'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.observe = observe; exports.drain = drain; var _runSource = require('../runSource'); var _transform = require('./transform'); /** * Observe all the event values in the stream in time order. The * provided function `f` will be called for each event value * @param {function(x:T):*} f function to call with each event value * @param {Stream} stream stream to observe * @return {Promise} promise that fulfills after the stream ends without * an error, or rejects if the stream ends with an error. */ /** @license MIT License (c) copyright 2010-2016 original author or authors */ /** @author Brian Cavalier */ /** @author John Hann */ function observe(f, stream) { return drain((0, _transform.tap)(f, stream)); } /** * "Run" a stream by creating demand and consuming all events * @param {Stream} stream stream to drain * @return {Promise} promise that fulfills after the stream ends without * an error, or rejects if the stream ends with an error. */ function drain(stream) { return (0, _runSource.withDefaultScheduler)(stream.source); }