UNPKG

@woocommerce/csv-export

Version:
34 lines 1.31 kB
export type Header = { label: string; key: string; }; export type RowItem = { display: string; value: string | number; }; export type Rows = Array<RowItem[]>; /** * Generates a CSV string from table contents * * @param {Array.<Header>} headers Object with table header information * @param {Array.Array.<RowItem>} rows Object with table rows information * @return {string} Table contents in a CSV format */ export declare function generateCSVDataFromTable(headers: Header[], rows: Rows): string; /** * Generates a file name for CSV files based on the provided name, the current date * and the provided params, which are all appended with hyphens. * * @param {string} [name=''] Name of the file * @param {Object} [params={}] Object of key-values to append to the file name * @return {string} Formatted file name */ export declare function generateCSVFileName(name?: string, params?: Record<string, string>): string; /** * Downloads a CSV file with the given file name and contents * * @param {string} fileName Name of the file to download * @param {string} content Contents of the file to download */ export declare function downloadCSVFile(fileName: string, content: BlobPart): void; //# sourceMappingURL=index.d.ts.map