diff --git a/contrib/most.ts b/contrib/most.ts index 1d00253..ac76972 100644 --- a/contrib/most.ts +++ b/contrib/most.ts @@ -2,7 +2,7 @@ import type { $, Kind, Nest, Out } from "../kind.ts"; import type { Applicable } from "../applicable.ts"; import type { Bind, Flatmappable, Tap } from "../flatmappable.ts"; import type { BindTo, Mappable } from "../mappable.ts"; -import type { Scheduler, Stream } from "npm:@most/types@1.1.0"; +import type { Scheduler, Sink, Stream } from "npm:@most/types@1.1.0"; import type { Wrappable } from "../wrappable.ts"; import * as M from "npm:@most/core@1.6.1"; @@ -70,6 +70,23 @@ export async function collect( return as; } +export function sink( + event: (time: number, value: A) => void, + error: (e: unknown) => void, + end: () => void, +): Sink { + return { event, end, error }; +} + +export const debugSink: Sink = sink( + console.log, + console.error, + console.log, +); + +const noop = () => {}; +export const voidSink: Sink = sink(noop, noop, noop); + export const wrap: Wrappable["wrap"] = M.now; export const map: Mappable["map"] = M.map;