New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

yield-stream

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yield-stream - npm Package Compare versions

Comparing version

to
1.0.1

7

dist/index.d.ts

@@ -10,3 +10,3 @@ import { GeneratorFn, StreamGenerator } from "./types";

*/
export declare const pipeline: <T>(stream: ReadableStream<T>, ...transforms: GeneratorFn<T>[]) => ReadableStream<Awaited<T>>;
export declare const pipeline: <T>(stream: ReadableStream<T>, ...transforms: GeneratorFn<T>[]) => ReadableStream<T>;
/**

@@ -24,2 +24,7 @@ * Iterates over a stream, yielding each chunk.

export declare const streamArray: <T>(array: T[]) => ReadableStream<T>;
/**
* Generator that accepts a generator `G` and yields an incrementing buffer of
* chunks.
*/
export declare const buffer: <T>(stream: ReadableStream<T>) => AsyncGenerator<T[], void, unknown>;
export * from "./types";

2

dist/index.js

@@ -1,1 +0,1 @@

const c=(...e)=>e.reduce((r,t)=>async function*(n){for await(const o of r(n))yield*t(o)}),d=(e,...r)=>{const t=c(...r);return a(async function*(){for await(const n of s(e))yield*t(n)})},s=async function*(e,r){const t=e.getReader();for(;!r?.signal.aborted;){const{done:n,value:o}=await t.read();if(n)break;yield o}},a=(e,r)=>new ReadableStream({async start(t){for await(const n of e(r))t.enqueue(n);t.close()}}),m=e=>a(function*(){for(const r of e)yield r});export*from"./types.js";export{c as compose,a as generateStream,d as pipeline,m as streamArray,s as yieldStream};
const s=(...r)=>r.reduce((e,t)=>async function*(a){for await(const n of e(a))yield*t(n)}),T=(r,...e)=>{const t=s(...e);return c(async function*(){for await(const a of o(r))yield*t(a)})},o=async function*(r,e){const t=r.getReader();for(;!e?.signal.aborted;){const{done:a,value:n}=await t.read();if(a)break;yield n}},c=(r,e)=>new ReadableStream({async start(t){for await(const a of r(e))t.enqueue(a);t.close()}}),d=r=>c(function*(){for(const e of r)yield e}),l=async function*(r){const e=[];for await(const t of o(r))e.push(t),yield e};export*from"./types.js";export{l as buffer,s as compose,c as generateStream,T as pipeline,d as streamArray,o as yieldStream};

@@ -5,3 +5,3 @@ /**

*/
export type GeneratorFn<T> = (data: T) => Generator<T> | AsyncGenerator<T>;
export type GeneratorFn<T> = (data?: T) => Generator<T> | AsyncGenerator<T>;
/**

@@ -8,0 +8,0 @@ * A generator function that receives a chunk of data and returns a generator

{
"name": "yield-stream",
"version": "1.0.0",
"version": "1.0.1",
"license": "MIT",

@@ -35,3 +35,4 @@ "type": "module",

"typescript": "^4.9.5"
}
},
"homepage": "https://github.com/gptlabs/yield-stream"
}