@naturalcycles/nodejs-lib
Version:
Standard library for Node.js
22 lines (21 loc) • 668 B
TypeScript
import { TransformTyped } from '../stream.model';
export interface TransformToNDJsonOptions {
/**
* @default true
* If true - will throw an error on JSON.parse / stringify error
*/
strict?: boolean;
/**
* @default false
* If true - will run `sortObjectDeep()` on each object to achieve deterministic sort
*/
sortObjects?: boolean;
/**
* @default `\n`
*/
separator?: string;
}
/**
* Transforms objects (objectMode=true) into chunks \n-terminated JSON strings (readableObjectMode=false).
*/
export declare function transformToNDJson<IN = any>(opt?: TransformToNDJsonOptions): TransformTyped<IN, string>;