@naturalcycles/nodejs-lib
Version:
Standard library for Node.js
21 lines (20 loc) • 722 B
TypeScript
import type { AnyObject } from '@naturalcycles/js-lib/types';
import type { TransformTyped } from '../stream/stream.model.js';
import type { CSVWriterConfig } from './csvWriter.js';
export interface TransformToCSVOptions extends CSVWriterConfig {
/**
* If true - will throw an error on stringify error
*
* @default true
*/
strict?: boolean;
}
/**
* Transforms objects (objectMode=true) into chunks \n-terminated CSV strings (readableObjectMode=false).
*/
export declare function transformToCSV<IN extends AnyObject = any>(opt: TransformToCSVOptions & {
/**
* Columns are required, as they cannot be detected on the fly.
*/
columns: string[];
}): TransformTyped<IN, string>;