export function* take(stream, limit) {
    if (limit < 1) {
        return;
    }
    let count = 0;
    for (const v of stream) {
        yield v;
        if (++count === limit) {
            break;
        }
    }
}
export function first(stream) {
    const it = stream[Symbol.iterator]();
    const { value } = it.next();
    it.return?.();
    return value;
}
//# sourceMappingURL=stream.js.map