arquero
Version:
Query processing and transformation of array-backed data tables.
65 lines (64 loc) • 2.57 kB
TypeScript
/**
* Options for CSV formatting.
* @typedef {object} CSVFormatOptions
* @property {string} [delimiter=','] The delimiter between values.
* @property {boolean} [header=true] Flag to specify presence of header row.
* If true, includes a header row with column names.
* If false, the header is omitted.
* @property {number} [limit=Infinity] The maximum number of rows to print.
* @property {number} [offset=0] The row offset indicating how many initial rows to skip.
* @property {import('./types.js').ColumnSelectOptions} [columns] Ordered list
* of column names to include. If function-valued, the function should
* accept a table as input and return an array of column name strings.
* @property {Object.<string, (value: any) => any>} [format] Object of column
* format options. The object keys should be column names. The object values
* should be formatting functions to invoke to transform column values prior
* to output. If specified, these override automatically inferred options.
*/
/**
* Format a table as a comma-separated values (CSV) string. Other
* delimiters, such as tabs or pipes ('|'), can be specified using
* the options argument.
* @param {import('../table/Table.js').Table} table The table to format.
* @param {CSVFormatOptions} options The formatting options.
* @return {string} A delimited-value format string.
*/
export function toCSV(table: import("../table/Table.js").Table, options?: CSVFormatOptions): string;
/**
* Options for CSV formatting.
*/
export type CSVFormatOptions = {
/**
* The delimiter between values.
*/
delimiter?: string;
/**
* Flag to specify presence of header row.
* If true, includes a header row with column names.
* If false, the header is omitted.
*/
header?: boolean;
/**
* The maximum number of rows to print.
*/
limit?: number;
/**
* The row offset indicating how many initial rows to skip.
*/
offset?: number;
/**
* Ordered list
* of column names to include. If function-valued, the function should
* accept a table as input and return an array of column name strings.
*/
columns?: import("./types.js").ColumnSelectOptions;
/**
* Object of column
* format options. The object keys should be column names. The object values
* should be formatting functions to invoke to transform column values prior
* to output. If specified, these override automatically inferred options.
*/
format?: {
[x: string]: (value: any) => any;
};
};