UNPKG

json-data-to-csv

Version:

A TypeScript library to convert array of objects to CSV format with customizable delimiter

25 lines (24 loc) 715 B
/** * Custom error class for JSON to CSV conversion errors */ export declare class JsonToCsvError extends Error { code?: string | undefined; constructor(message: string, code?: string | undefined); } /** * Options for the parse method */ export interface ParseOptions { delimiter?: string; } /** * Type for the input data - array of objects with string keys */ export type JsonData = Record<string, any>[]; /** * Parses an array of objects into CSV format * @param data - Array of objects to convert to CSV * @param options - Options for parsing (delimiter) * @returns CSV string with header row and data rows */ export declare function parse(data: JsonData, options?: ParseOptions): string;