Skip to main content
Module

std/encoding/csv.ts>ParseOptions

Deno standard library
Go to Latest
interface ParseOptions
implements ReadOptions
import { type ParseOptions } from "https://deno.land/std@0.102.0/encoding/csv.ts";

Properties

optional
skipFirstRow: boolean

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.

optional
parse: (input: unknown) => unknown

Parse function for rows. Example: const r = await parseFile('a,b,c\ne,f,g\n', { columns: ["this", "is", "sparta"], parse: (e: Record<string, unknown>) => { return { super: e.this, street: e.is, fighter: e.sparta }; } }); // output [ { super: "a", street: "b", fighter: "c" }, { super: "e", street: "f", fighter: "g" } ]