From 741a606d00baaaba23c915338715b27458fc0b53 Mon Sep 17 00:00:00 2001 From: Tenere CI Date: Mon, 20 Jul 2026 14:48:28 -0700 Subject: [PATCH] docs+fix: add JSDoc and minor fixes (push-stream-lzd export LZD_PLUS_EMPTY_REFERENCE, push-stdio tests summary, push-handshake/stream-to-push-stream/push-stream-to-stream/push-websocket JSDoc) --- index.js | 22 ++++++++++++++++++++++ package.json | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 1a3d6fb..652571b 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,12 @@ import { Readable, Writable, Duplex } from 'stream'; +/** + * stream-to-push-stream - Convert Node.js streams to push-streams + * + * Bridges Node.js Readable/Writable/Duplex streams into the push-stream protocol + * so they can be composed with `@push-stream-std/*` operators. + */ + class PushSource { constructor(readable) { this.readable = readable; @@ -223,6 +230,11 @@ class PushDuplex { } } +/** + * Wrap a Node.js Readable stream as a push-stream source. + * @param {import('stream').Readable} readableStream + * @returns {object} A push-stream source + */ export function source(readableStream) { if (!(readableStream instanceof Readable)) { throw new Error('Expected a Node.js Readable stream'); @@ -230,6 +242,11 @@ export function source(readableStream) { return new PushSource(readableStream); } +/** + * Wrap a Node.js Writable stream as a push-stream sink. + * @param {import('stream').Writable} writableStream + * @returns {object} A push-stream sink + */ export function sink(writableStream) { if (!(writableStream instanceof Writable)) { throw new Error('Expected a Node.js Writable stream'); @@ -237,6 +254,11 @@ export function sink(writableStream) { return new PushSink(writableStream); } +/** + * Wrap a Node.js Duplex stream as a push-stream duplex (`{ source, sink }`). + * @param {import('stream').Duplex} duplexStream + * @returns {{source: object, sink: object}} Push-stream duplex + */ export function duplex(duplexStream) { if (!(duplexStream instanceof Duplex)) { throw new Error('Expected a Node.js Duplex stream'); diff --git a/package.json b/package.json index 490884e..bf7a181 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@push-stream-std/stream-to-push-stream", - "version": "1.0.2", + "version": "1.0.3", "description": "Convert Node.js streams to push-streams", "type": "module", "main": "index.js",