Update interface

This commit is contained in:
Jerry Kurian
2019-09-13 08:57:19 -04:00
parent 158475183a
commit 70edee51c4
3 changed files with 30 additions and 25 deletions

View File

@@ -1,18 +1,11 @@
import { Transform } from "stream";
import {
AccumulatorByIteratee,
FlushStrategy,
TransformOptions,
} from "./baseDefinitions";
import { Transform, TransformOptions } from "stream";
import { AccumulatorByIteratee, FlushStrategy } from "./baseDefinitions";
import { batch } from ".";
function _accumulator<T>(
accumulateBy: (data: T, buffer: T[], stream: Transform) => void,
shouldFlush: boolean = true,
options: TransformOptions = {
readableObjectMode: true,
writableObjectMode: true,
},
options: TransformOptions = {},
) {
const buffer: T[] = [];
return new Transform({
@@ -128,10 +121,7 @@ export function accumulator(
flushStrategy: FlushStrategy,
batchSize: number,
keyBy?: string,
options: TransformOptions = {
readableObjectMode: true,
writableObjectMode: true,
},
options?: TransformOptions,
): Transform {
if (flushStrategy === FlushStrategy.sliding) {
return sliding(batchSize, keyBy, options);
@@ -145,10 +135,7 @@ export function accumulator(
export function accumulatorBy<T, S extends FlushStrategy>(
flushStrategy: S,
iteratee: AccumulatorByIteratee<T>,
options: TransformOptions = {
readableObjectMode: true,
writableObjectMode: true,
},
options?: TransformOptions,
): Transform {
if (flushStrategy === FlushStrategy.sliding) {
return slidingBy(iteratee, options);

View File

@@ -43,7 +43,7 @@ class Demux extends Writable {
destKey?: string,
) => NodeJS.WritableStream | NodeJS.ReadWriteStream,
demuxBy: string | ((chunk: any) => string),
options?: WritableOptions,
options: WritableOptions = {},
) {
super(options);
this.demuxer =