push-stream-std

@push-stream-std/push-combine-latest (0.0.5)

Published 2026-07-20 18:59:23 +00:00 by Dvorak

Installation

@push-stream-std:registry=https://hub.kl1.tenere.ai/api/packages/push-stream-std/npm/
npm install @push-stream-std/push-combine-latest@0.0.5
"@push-stream-std/push-combine-latest": "0.0.5"

About this package

push-combine-latest

Combine multiple sources, emitting on any update.

Published as @push-stream-std/push-combine-latest.

Synopsis

import combineLatest from '@push-stream-std/push-combine-latest';

const sourceA = /* push stream producing 'a', 'b' */;
const sourceB = /* push stream producing 1, 2 */;

const combined = combineLatest([sourceA, sourceB]);
combined.pipe(sink);

// Output: ['b', 1], ['b', 2]

Install

npm config set @push-stream-std:registry https://hub.kl1.tenere.ai/api/packages/push-stream-std/npm/
npm config set -- //hub.kl1.tenere.ai/api/packages/push-stream-std/npm/:_authToken "$PACKAGE_TOKEN"
npm install @push-stream-std/push-combine-latest

Description

A source-like stream that subscribes to multiple upstream push-stream sources and emits an array of the latest value from each source whenever any source emits a new value. Emits are only produced when all sources have delivered at least one value. Incomplete sources (that ended without producing a value) prevent any emission. Useful for reactive computations where you need the most recent state from several data streams.

API

combineLatest(sources)

Creates a combine-latest stream.

  • sources Array – An array of push-stream source objects.
  • Returns A stream with pipe(), write(), end(), abort(), resume(), paused, and ended. The stream acts as a sink for individual sources and as a source for the downstream.

Tests

npm test

Tests cover emitting combined values when all sources have data, sources emitting at different rates, a single source wrapping values in arrays, both sources empty (no emission), one empty and one non-empty source (no emission due to incomplete source), abort propagation, and three-source combination.

Requirements

Node.js 18 or later. ESM only.

License

MIT

Keywords

push-stream stream combine
Details
npm
2026-07-20 18:59:23 +00:00
0
SEE LICENSE IN LICENSE
3.8 KiB
Assets (1)
Versions (5) View all
0.0.7 2026-07-21
0.0.6 2026-07-20
0.0.5 2026-07-20
0.0.4 2026-07-19
0.0.3 2026-07-19