p-transform
Advanced tools
Comparing version 4.1.3 to 4.1.4
/// <reference types="node" resolution-mode="require"/> | ||
import type { pipeline as pipelineType } from 'node:stream/promises'; | ||
import { type DuplexWithDebug, type TransformMethod } from './queue.js'; | ||
import { type DuplexWithDebug, type TransformMethod, type TransformLike } from './queue.js'; | ||
export * from './queue.js'; | ||
declare const pipeline: typeof pipelineType; | ||
export { pipeline }; | ||
export declare const transform: <ChunkType = any>(transform: TransformMethod<ChunkType>, end?: ((this: { | ||
push: (chunk: ChunkType) => void; | ||
}) => void | Promise<void>) | undefined) => DuplexWithDebug; | ||
export declare const transform: <ChunkType = any>(transform: TransformMethod<ChunkType>, end?: ((this: TransformLike<ChunkType>) => void | Promise<void>) | undefined) => DuplexWithDebug; | ||
/** | ||
* Shortcut to create a passthrough with spy. | ||
*/ | ||
export declare const passthrough: <ChunkType = any>(spy?: ((chunk: ChunkType) => Promise<void> | void) | undefined, end?: ((this: { | ||
push: (chunk: ChunkType) => void; | ||
}) => void | Promise<void>) | undefined) => DuplexWithDebug; | ||
export declare const passthrough: <ChunkType = any>(spy?: ((this: TransformLike<ChunkType>, chunk: ChunkType) => Promise<void> | void) | undefined, end?: ((this: TransformLike<ChunkType>) => void | Promise<void>) | undefined) => DuplexWithDebug; | ||
/** | ||
* Create a filter stream. | ||
*/ | ||
export declare const filter: <ChunkType = any>(filter: (chunk: ChunkType) => boolean | Promise<boolean>, end?: ((this: { | ||
push: (chunk: ChunkType) => void; | ||
}) => void) | undefined) => DuplexWithDebug; | ||
export declare const filter: <ChunkType = any>(filter: (chunk: ChunkType) => boolean | Promise<boolean>, end?: ((this: TransformLike<ChunkType>) => void) | undefined) => DuplexWithDebug; |
@@ -12,4 +12,4 @@ import { Stream } from 'readable-stream'; | ||
*/ | ||
export const passthrough = (spy, end) => transform(async (chunk) => { | ||
await spy?.(chunk); | ||
export const passthrough = (spy, end) => transform(async function (chunk) { | ||
await spy?.call(this, chunk); | ||
return chunk; | ||
@@ -16,0 +16,0 @@ }, end); |
{ | ||
"name": "p-transform", | ||
"version": "4.1.3", | ||
"version": "4.1.4", | ||
"bugs": "https://github.com/mshima/p-transform/issues", | ||
@@ -5,0 +5,0 @@ "repository": { |
23648
198