interface ParseOptions
implements ReadOptions
import { type ParseOptions } from "https://dotland.deno.dev/std@0.116.0/encoding/csv.ts";
Properties
If you provide skipFirstRow: true
and columns
, the first line will be skipped.
If you provide skipFirstRow: true
but not columns
, the first line will be skipped and used as header definitions.
optional
columns: string[] | ColumnOptions[]If you provide string[]
or ColumnOptions[]
, those names will be used for header definition.
Parse function for rows. Example:
import { parse } from "./csv.ts";
const r = await parse('a,b,c\ne,f,g\n', {
columns: ["this", "is", "sparta"],
parse: (_e: unknown) => {
const e = _e as { this: unknown, is: unknown, sparta: unknown };
return { super: e.this, street: e.is, fighter: e.sparta };
}
});
// output
// [
// { super: "a", street: "b", fighter: "c" },
// { super: "e", street: "f", fighter: "g" }
// ]