import { EventStream, EventStreamSeed, Scope } from "./abstractions" import { fromSubscribe } from "./fromsubscribe" import { nop, rename } from "./util" /** */ export function fromArray(events: V[], scope: Scope): EventStream export function fromArray(events: V[]): EventStreamSeed export function fromArray(events: V[], scope?: Scope): any { // TODO: rename to use Description as well return rename( `fromArray(${events},fn)`, fromSubscribe((onValue, onEnd = nop) => { events.forEach(onValue) onEnd && onEnd() return nop }, scope as any) ) }