You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Set `handleHeaders` to an `Array<any>` to replace the header row (first row) in the output.
//
// Notes:
// - The header row is assumed to be the first row in the input CSV, and by default it goes directly to the output (skipping the user-provided transformation function).
// - Setting `handleHeaders` to an array is the simplest way to rename headers, delete headers, or add new headers.
import { CSVReader, CSVTransformer, CSVWriter } from '../src/index.js';
/** @import { TransformationFunction } from '../src/index.js'; */
/** @type {TransformationFunction} */
function sum(row) {
return [...row, Number(row[0]) + Number(row[1])];
}
await new CSVReader(new URL('./data/ex1_2-in.csv', import.meta.url))