@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 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 18 or later. ESM only.
License
MIT
Keywords
push-stream
stream
drop
filter
skip