UNPKG

@iwsio/json-csv-core

Version:

Easily convert JSON to CSV. This is a core library built for browser and node to support buffered conversion to CSV.

14 lines (13 loc) 937 B
import { ExportOptions, FieldList } from './types.js'; export declare function checkOptions(opts?: Partial<ExportOptions>): ExportOptions; /** * Main entry point. Convert a buffered array of data to a CSV string. */ export declare function buffered(data: Record<string, unknown>[], opts: Partial<ExportOptions>): string; export declare function prepValue(text: string, forceQuoted: boolean, fieldSeparator: string): unknown; export declare function getHeaderRow(fields: FieldList, fieldSeparator: string): string; export declare function getBodyRow(data: Record<string, unknown> | undefined | null, fields: FieldList, fieldSeparator: string): string; export declare function getValue(data: Record<string, unknown>, keyPath: string): unknown; export declare function getValueIx(data: Record<string, unknown> | undefined | null, keys: string[], ix: number): unknown; export declare const toCsv: typeof buffered; export default buffered;