@@ -14,7 +14,7 @@ import { filenameOrFileToContent } from "./unwrappers"
1414 * @param text - The CSV string or file to parse.
1515 * @param options - Optional configuration for parsing.
1616 * @param options.delimiter - The delimiter used in the CSV, defaults to a comma.
17- * @param options.headers - Column headers for the CSV, as an array or single value.
17+ * @param options.headers - Column headers for the CSV, as an array or single value. If not provided, headers are inferred from the first line.
1818 * @param options.repair - Whether to repair common escape errors, defaults to false.
1919 * @returns An array of objects representing the parsed CSV data.
2020 */
@@ -55,13 +55,13 @@ export function CSVParse(
5555/**
5656 * Attempts to parse a CSV string into an array of objects, handling errors gracefully.
5757 *
58- * @param text - The CSV string to parse.
58+ * @param text - The CSV string to parse. Returns an empty array if the input is empty.
5959 * @param options - Optional configuration for parsing and error handling.
60- * @param options.delimiter - Delimiter to separate values, defaults to comma.
61- * @param options.headers - Array of column headers for the parsed data.
62- * @param options.repair - Flag to enable basic error correction in the input data.
63- * @param options.trace - Optional trace function for logging errors during parsing.
64- * @returns An array of objects representing the parsed CSV data, or undefined on error.
60+ * @param options.delimiter - The delimiter used to separate values, defaults to a comma.
61+ * @param options.headers - Column headers for the parsed data, as an array or single value .
62+ * @param options.repair - Enables basic error correction in the input data.
63+ * @param options.trace - Trace function for logging errors during parsing.
64+ * @returns An array of objects representing the parsed CSV data, or undefined if an error occurs .
6565 */
6666export function CSVTryParse (
6767 text : string ,
@@ -87,7 +87,7 @@ export function CSVTryParse(
8787 * Converts an array of objects into a CSV string.
8888 *
8989 * @param csv - Array of objects to convert to CSV format. Returns an empty string if the input is null or undefined.
90- * @param options - Optional configuration for CSV stringification, including headers and delimiter settings.
90+ * @param options - Configuration for CSV stringification, including headers and delimiter settings.
9191 * @returns A CSV formatted string representation of the input data.
9292 */
9393export function CSVStringify ( csv : object [ ] , options ?: CSVStringifyOptions ) {
@@ -97,12 +97,12 @@ export function CSVStringify(csv: object[], options?: CSVStringifyOptions) {
9797}
9898
9999/**
100- * Converts an array of objects into a Markdown table format .
100+ * Converts an array of objects into a Markdown table.
101101 *
102- * @param csv - The array of objects representing CSV data.
103- * @param options - Options for formatting the table.
104- * @param options.headers - Array of headers for the table columns.
105- * @returns A string representing the CSV data in Markdown table format .
102+ * @param csv - Array of objects representing the data to convert .
103+ * @param options - Configuration options for the table.
104+ * @param options.headers - Headers for the table columns. If not provided, keys from the first object are used .
105+ * @returns A Markdown table as a string .
106106 */
107107export function dataToMarkdownTable (
108108 csv : object [ ] ,
@@ -154,9 +154,9 @@ export function objectToMarkdownTableRow(
154154/**
155155 * Splits an array of objects into chunks of a specified size.
156156 *
157- * @param rows - The array of objects to split into chunks.
158- * @param size - The size of each chunk.
159- * @returns An array of chunk objects with starting index and rows.
157+ * @param rows - Array of objects to be divided into chunks.
158+ * @param size - Number of objects per chunk. Must be at least 1 .
159+ * @returns Array of chunk objects, each containing a starting index and rows.
160160 */
161161export function CSVChunk (
162162 rows : object [ ] ,
0 commit comments