*/
constructor(fn, options = {}) {
super({
- transform: (chunk, controller) => this.transform(chunk, controller),
- flush: (controller) => this.flush(controller),
+ transform: (chunk, controller) => this.#transform(chunk, controller),
+ flush: (controller) => this.#flush(controller),
});
options.includeHeaders ??= false;
}
}
- async transform(chunk, controller) {
+ async #transform(chunk, controller) {
const { includeHeaders, rawInput, maxBatchSize } = this.#options;
const row = rawInput ? chunk : JSON.parse(chunk);
let out;
this.#enqueueRow(out, controller);
}
- async flush(controller) {
+ async #flush(controller) {
if (this.#batch.length > 0) {
const out = await this.#wrappedFn(this.#batch);
this.#enqueueRow(out, controller);