Skip to main content

@std/csv@0.215.0

latest
Works with
It is unknown whether this package works with Browsers, Deno, Node.js, Cloudflare Workers, Bun
It is unknown whether this package works with Browsers
It is unknown whether this package works with Deno
It is unknown whether this package works with Node.js
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score70%
Published2 years ago (0.215.0)
function parse
parse(
input: string,
opt?: undefined
): string[][]

Csv parse helper to manipulate data. Provides an auto/custom mapper for columns.

Examples

Example 1

import { parse } from "@std/csv/parse";
const string = "a,b,c\nd,e,f";

console.log(
  await parse(string, {
    skipFirstRow: false,
  }),
);
// output:
// [["a", "b", "c"], ["d", "e", "f"]]

Parameters

Input to parse.

optional
opt: undefined

options of the parser.

Return Type

If you don't provide opt.skipFirstRow and opt.columns, it returns string[][]. If you provide opt.skipFirstRow or opt.columns, it returns Record<string, unknown>[].

parse<T extends ParseOptions>(
input: string,
opt: T
): ParseResult<ParseOptions, T>

Csv parse helper to manipulate data. Provides an auto/custom mapper for columns.

Examples

Example 1

import { parse } from "@std/csv/parse";
const string = "a,b,c\nd,e,f";

console.log(
  await parse(string, {
    skipFirstRow: false,
  }),
);
// output:
// [["a", "b", "c"], ["d", "e", "f"]]

Type Parameters

Parameters

Input to parse.

options of the parser.

Return Type

If you don't provide opt.skipFirstRow and opt.columns, it returns string[][]. If you provide opt.skipFirstRow or opt.columns, it returns Record<string, unknown>[].

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/csv

Import symbol

import { parse } from "@std/csv";
or

Import directly with a jsr specifier

import { parse } from "jsr:@std/csv";