Skip to content

Latest commit

 

History

History
62 lines (55 loc) · 3.65 KB

File metadata and controls

62 lines (55 loc) · 3.65 KB

Operators

Operators are functions of the form: type Op<T, R> = (src: ReadableStream<T>) => ReadableStream<R> This only requires ReadableStream to be implemented/available with getReader support.

Operator Categories

Transformation Operators

Transform each value or the entire stream structure:

  • map - Transform each value through a function
  • mapSync - Synchronous transformation for better performance
  • scan - Accumulate values and emit intermediate results
  • reduce - Accumulate values and emit only the final result
  • switchMap - Map to streams, switch to latest (with cancellation)
  • concatMap - Map to streams, concatenate sequentially
  • mergeMap - Map to streams, merge concurrently
  • exhaustMap - Map to streams, ignore new while active
  • switchAll - Flatten stream of streams, switch to latest
  • concatAll - Flatten stream of streams sequentially
  • mergeAll - Flatten stream of streams concurrently
  • exhaustAll - Flatten stream of streams, ignore new while active
  • pairwise - Emit previous and current values as pairs

Filtering Operators

Filter or limit the values that pass through:

Timing Operators

Control the timing of emissions:

  • debounceTime - Emit latest value after quiet period
  • throttleTime - Limit emission rate
  • delay - Delay all emissions by specified time
  • timeout - Error if no emission within duration

Buffering Operators

Collect and group values:

  • buffer - Buffer into arrays of specified size
  • startWith - Prepend values to stream

Utility Operators

Observe, handle errors, and control flow:

  • tap - Observe values without modification
  • on - Attach lifecycle callbacks
  • catchError - Handle errors with fallback stream
  • schedule - Control emission timing with scheduler
  • through - Use native TransformStream
  • withLatestFrom - Combine with latest from other stream
  • defaultIfEmpty - Provide default for empty streams
  • count - Count values (optionally with predicate)
  • bridge - Bridge to external stream systems