import { Stream } from '@motorcycle/types' import { curry2 } from '@most/prelude' import { drain } from './drain' import { tap } from './tap' /** * Activates a stream, calling a function `f` with each event value, and returns * a Promise of completion. * * @name observe(f: (value: A) => any, stream: Stream): Promise */ export const observe: Observe = curry2((f: (value: A) => any, stream: Stream): Promise< void > => drain(tap(f, stream))) export interface Observe { (f: (value: A) => any, stream: Stream): Promise (f: (value: A) => any): (stream: Stream) => Promise }