Huge News!Announcing our $40M Series B led by Abstract Ventures.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 2.2.0 to 2.3.0

dist/lib.d.ts

30

dist/index.d.ts

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc