push-stream-std

@push-stream-std/push-drop-while (0.0.5)

Published 2026-07-20 18:59:33 +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-drop-while@0.0.5
"@push-stream-std/push-drop-while": "0.0.5"

About this package

push-drop-while

Drop elements while predicate true, keep rest.

Published as @push-stream-std/push-drop-while.

Synopsis

import { dropWhile } from '@push-stream-std/push-drop-while';
import { values } from '@push-stream-std/push-values';
import { collect } from '@push-stream-std/push-collect';

const source = values([0, 1, 2, 3, 4, 5]);
const afterZero = dropWhile((n) => n < 3);

collect(source.pipe(afterZero), (err, result) => {
  console.log(result); // [3, 4, 5]
});

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-drop-while

Description

A through stream that drops values from the source while a predicate returns true. Once the predicate returns false for a value, subsequent values pass through unconditionally. This is the push-stream equivalent of array dropWhile — useful for skipping headers, preamble data, or initial unwanted elements in a stream.

API

dropWhile(predicate)

Returns a through stream that drops initial values matching the predicate.

  • predicate (value) => boolean — A function that receives each value. Values are dropped while this returns true. After the first false, all remaining values pass through regardless.
  • Returns through — A push-stream through that drops leading values.

Tests

npm test

Tests cover dropping while true, passthrough after match, no match (all pass through), all match (all dropped), and abort/end propagation.

Requirements

Node.js 18 or later. ESM only.

License

MIT

Keywords

push-stream stream drop filter skip
Details
npm
2026-07-20 18:59:33 +00:00
0
SEE LICENSE IN LICENSE
3.3 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