Options
All
  • Public
  • Public/Protected
  • All
Menu

@iov/stream Documentation

Index

Type aliases

ReducerFunc

ReducerFunc<T, U>: function

Type parameters

  • T

  • U

Type declaration

    • (acc: U, evt: T): U
    • Parameters

      • acc: U
      • evt: T

      Returns U

SameTypeStreamOperator

SameTypeStreamOperator<T>: function

The type that fits into Stream.compose() with input stream and output stream of the same type.

Type parameters

  • T

Type declaration

    • (ins: Stream<T>): Stream<T>
    • Parameters

      • ins: Stream<T>

      Returns Stream<T>

SearchFunction

SearchFunction<T>: function

Type parameters

  • T

Type declaration

    • (value: T): boolean
    • Parameters

      • value: T

      Returns boolean

Functions

asArray

  • asArray<T>(stream: Stream<T>): Reducer<T, keyof T[]>
  • Type parameters

    • T

    Parameters

    • stream: Stream<T>

    Returns Reducer<T, keyof T[]>

concat

  • concat<T>(...streams: Stream<T>[]): Stream<T>
  • An implementation of concat that buffers all source stream events

    Marble diagram:

    --1--2---3---4-|
    -a--b-c--d-|
    --------X---------Y---------Z-
              concat
    --1--2---3---4-abcdXY-------Z-

    This is inspired by RxJS's concat as documented at http://rxmarbles.com/#concat and behaves differently than xstream's concat as discussed in https://github.com/staltz/xstream/issues/170.

    Type parameters

    • T

    Parameters

    • Rest ...streams: Stream<T>[]

    Returns Stream<T>

countStream

  • countStream<T>(stream: Stream<T>): Reducer<T, number>
  • Type parameters

    • T

    Parameters

    • stream: Stream<T>

    Returns Reducer<T, number>

dropDuplicates

  • Drops duplicate values in a stream.

    Marble diagram:

    -1-1-1-2-4-3-3-4--
      dropDuplicates
    -1-----2-4-3------

    Each value must be uniquely identified by a string given by valueToKey(value).

    Internally this maintains a set of keys that have been processed already, i.e. memory consumption and Set lookup times should be considered when using this function.

    Type parameters

    • T

    Parameters

    • valueToKey: function
        • (x: T): string
        • Parameters

          • x: T

          Returns string

    Returns SameTypeStreamOperator<T>

firstEvent

  • firstEvent<T>(stream: Stream<T>): Promise<T>
  • Listens to stream, collects one event and revolves.

    Rejects if stream completes before one event was fired.

    Type parameters

    • T

    Parameters

    • stream: Stream<T>

    Returns Promise<T>

fromListPromise

  • fromListPromise<T>(promise: Promise<Iterable<T>>): Stream<T>
  • Emits one event for each list element as soon as the promise resolves

    Type parameters

    • T

    Parameters

    • promise: Promise<Iterable<T>>

    Returns Stream<T>

lastValue

  • lastValue<T>(stream: Stream<T>): Reducer<T, T | undefined>
  • Type parameters

    • T

    Parameters

    • stream: Stream<T>

    Returns Reducer<T, T | undefined>

toListPromise

  • toListPromise<T>(stream: Stream<T>, count: number): Promise<keyof T[]>
  • Listens to stream and collects events. When count events are collected, the promise resolves with an array of events.

    Rejects if stream completes before count events are collected.

    Type parameters

    • T

    Parameters

    • stream: Stream<T>
    • count: number

    Returns Promise<keyof T[]>

Generated using TypeDoc