Skip to content

@epikodelabs/streamix


@epikodelabs/streamix / fromAny

Function: fromAny()

fromAny<R>(value): Stream<R>

Defined in: projects/libraries/streamix/src/lib/converters/fromAny.ts:21

Converts various value types into a Stream.

This function normalizes different input types into a consistent Stream interface:

  • Streams are passed through as-is
  • Promises are awaited and their resolved values are processed
  • Arrays have each element emitted individually
  • Single values are emitted as-is

Type Parameters

R

R = any

The type of values emitted by the resulting stream.

Parameters

value

The input value to convert. Can be:

  • a <R>
  • a Promise<R> (single value)
  • a Promise<Array<R>> (multiple values from array)
  • a plain value R
  • an array Array<R>

Stream<R> | MaybePromise<R> | R[]

Returns

Stream<R>

A <R> that emits the normalized values.

Released under the MIT License.