@push-stream-std/push-drop-while (0.0.7)
Published 2026-07-21 03:58:14 +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.7"@push-stream-std/push-drop-while": "0.0.7"About this package
@push-stream-std/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-pushable';
import { collect } from '@push-stream-std/push-concat';
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
Why
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 returnstrue. After the firstfalse, 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 22 or later. ESM only.
Keywords
push-stream
stream
drop
filter
skip