yield-stream
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -1,30 +0,2 @@ | ||
import { GeneratorFn, StreamGenerator } from "./types"; | ||
/** | ||
* `compose(f, g, h, ...)` returns a generator function `G(data)` that yields | ||
* all `(f · g · h · ...)(data)`. | ||
* | ||
* @note Used to compose multiple transforms into a `pipeline`. | ||
*/ | ||
export declare const compose: <Chunk>(...generators: GeneratorFn<Chunk>[]) => GeneratorFn<Chunk>; | ||
/** | ||
* Accepts a stream and transforms and returns a stream of the transformed | ||
* chunks. Transforms can yield multiple chunks per input chunk. | ||
*/ | ||
export declare const pipeline: <Chunk>(stream: ReadableStream<Chunk>, ...transforms: GeneratorFn<Chunk>[]) => ReadableStream<Chunk>; | ||
/** | ||
* Accepts a stream and yields all of its chunks. | ||
*/ | ||
export declare const yieldStream: <Chunk>(stream: ReadableStream<Chunk>, controller?: AbortController) => AsyncGenerator<Awaited<Chunk>, void, unknown>; | ||
/** | ||
* Accepts a generator function and streams its outputs. | ||
*/ | ||
export declare const generateStream: <Chunk, Return, Data>(G: StreamGenerator<Data, Chunk, Return>, data?: Data | undefined) => ReadableStream<Chunk>; | ||
/** | ||
* Accepts an array and returns a stream of its items. | ||
*/ | ||
export declare const streamArray: <Chunk>(array: Chunk[]) => ReadableStream<Chunk>; | ||
/** | ||
* Accepts a stream and yields a growing buffer of all chunks received. | ||
*/ | ||
export declare const buffer: <Chunk>(stream: ReadableStream<Chunk>) => AsyncGenerator<Chunk[], void, unknown>; | ||
export * from "./lib"; | ||
export * from "./types"; |
@@ -1,1 +0,1 @@ | ||
const c=(...n)=>n.reduce((e,t)=>async function*(r){for await(const a of e(r))yield*t(a)}),i=(n,...e)=>{const t=c(...e);return u(async function*(){for await(const r of o(n))yield*t(r)})},o=async function*(n,e){const t=n.getReader();for(;!e?.signal.aborted;){const{done:r,value:a}=await t.read();if(r)break;yield a}},u=(n,e)=>new ReadableStream({async start(t){for await(const r of n(e))t.enqueue(r);t.close()}}),f=n=>u(function*(){for(const e of n)yield e}),d=async function*(n){const e=[];for await(const t of o(n))e.push(t),yield e};export*from"./types.js";export{d as buffer,c as compose,u as generateStream,i as pipeline,f as streamArray,o as yieldStream}; | ||
export*from"./lib.js";export*from"./types.js"; |
{ | ||
"name": "yield-stream", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "type": "module", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7186
10
50