@berkelium/berkelium
Version:
A lightweight JavaScript library for data analysis and manipulation.
25 lines • 1.21 kB
TypeScript
export declare class DataReader {
/**
* Parses a CSV formatted string into an array of objects.
* Each object represents a row in the CSV data, with keys derived from the header row.
*
* @param {string} csvData - The CSV data as a string.
* @param {string} [delimiter=','] - The delimiter used to separate values in the CSV data.
* @returns {Record<string, any>[]} An array of objects where each object corresponds to a row in the CSV data.
*/
readCSV(csvData: string, delimiter?: string): Record<string, any>[];
/**
* Converts string values in the data to their appropriate data types.
* Detects and transforms strings to number, boolean, null, undefined, Date, object, or other types.
* @param {Record<string, any>[]} data - Array of objects representing the data.
* @returns {Record<string, any>[]} - Transformed data with inferred types.
*/
private transformDataTypes;
/**
* Infers and converts a value to its appropriate type.
* @param {string} value - The value to transform.
* @returns {*} - The value converted to its appropriate type.
*/
private inferType;
}
//# sourceMappingURL=datareader.d.ts.map