// operator/skip.ts
/*
* Copyright (c) 2021-2026 Check Digit, LLC
*
* This code is licensed under the MIT license (see LICENSE.txt for details).
*/
import type { Asyncerator } from '../asyncerator.ts';
import type { Operator } from './index.ts';
/**
* Skip numberToSkip values at the start of a stream.
* @param numberToSkip
*/
export default function (numberToSkip = 1): Operator {
return async function* (iterator: Asyncerator) {
let count = 0;
for await (const item of iterator) {
if (count++ >= numberToSkip) {
yield item;
}
}
};
}