Show:
Extends Core.EventHandler

A SimpleStream wraps an EventHandler and provides convenience methods of map, filter, split, and pluck to transform one stream into another.

Constructor

Streams.SimpleStream

() private

Example:

Item Index

Methods

Methods

filter

(
  • filterFn
)
SimpleStream

Filter converts the current stream into a new stream that only emits if the filter condition is satisfied. The filter function should return a Boolean value.

Parameters:

  • filterFn Function

    Function to filter event payload

Returns:

SimpleStream:

stream Filtered stream

map

(
  • mapperFn
)
SimpleStream

Map converts the current stream into a new stream with a modified (mapped) data payload.

Parameters:

  • mapperFn Function

    Function to map event payload

Returns:

SimpleStream:

stream Mapped stream

pluck

(
  • key
)
SimpleStream

Pluck is an opinionated mapper. It projects a Stream onto one of its return values.

Useful if a Stream returns an array or object.

Parameters:

Returns:

SimpleStream:

stream Plucked stream

split

(
  • splitterFn
)

Split maps one of several streams based on custom logic. The splitter function should return an EventEmitter type.

Parameters: