diff options
Diffstat (limited to 'std/encoding/README.md')
-rw-r--r-- | std/encoding/README.md | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/std/encoding/README.md b/std/encoding/README.md index 21797a451..2f0ac91f1 100644 --- a/std/encoding/README.md +++ b/std/encoding/README.md @@ -37,25 +37,29 @@ writeVarbig(w: Deno.Writer, x: bigint, o: VarbigOptions = {}): Promise<number> Parse the CSV from the `reader` with the options provided and return `string[][]`. -#### `parse(input: string | BufReader, opt: ParseOptions = { header: false }): Promise<unknown[]>`: +#### `parse(input: string | BufReader, opt: ParseOptions = { skipFirstRow: false }): Promise<unknown[]>`: Parse the CSV string/buffer with the options provided. The result of this function is as follows: -- If you don't provide both `opt.header` and `opt.parse`, it returns - `string[][]`. -- If you provide `opt.header` but not `opt.parse`, it returns `object[]`. +- If you don't provide `opt.skipFirstRow`, `opt.parse`, and `opt.columns`, it + returns `string[][]`. +- If you provide `opt.skipFirstRow` or `opt.columns` but not `opt.parse`, it + returns `object[]`. - If you provide `opt.parse`, it returns an array where each element is the value returned from `opt.parse`. ##### `ParseOptions` -- **`header: boolean | string[] | HeaderOptions[];`**: If a boolean is provided, - the first line will be used as Header definitions. If `string[]` or - `HeaderOptions[]` those names will be used for header definition. +- **`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. +- **`columns: string[] | HeaderOptions[];`**: If you provide `string[]` or + `ColumnOptions[]`, those names will be used for header definition. - **`parse?: (input: unknown) => unknown;`**: Parse function for the row, which will be executed after parsing of all columns. Therefore if you don't provide - header and parse function with headers, input will be `string[]`. + `skipFirstRow`, `columns`, and `parse` function, input will be `string[]`. ##### `HeaderOptions` |