web-csv-toolbox
    Preparing search index...

    Function parseString

    • Parse CSV string to records.

      Type Parameters

      • const CSVSource extends string

      Parameters

      Returns AsyncIterableIterator<CSVRecord<PickCSVHeader<CSVSource>>>

      Async iterable iterator of records.

      If you want array of records, use parseString.toArray function.

      import { parseString } from 'web-csv-toolbox';

      const csv = `name,age
      Alice,42
      Bob,69`;

      for await (const record of parseString(csv)) {
      console.log(record);
      }
      // Prints:
      // { name: 'Alice', age: '42' }
      // { name: 'Bob', age: '69' }
    • Parse CSV string to records.

      Type Parameters

      • const Header extends readonly string[]

      Parameters

      • csv: string

        CSV string to parse

      Returns AsyncIterableIterator<CSVRecord<Header>>

      Async iterable iterator of records.

      If you want array of records, use parseString.toArray function.

      import { parseString } from 'web-csv-toolbox';

      const csv = `name,age
      Alice,42
      Bob,69`;

      for await (const record of parseString(csv)) {
      console.log(record);
      }
      // Prints:
      // { name: 'Alice', age: '42' }
      // { name: 'Bob', age: '69' }
    • Parse CSV string to records.

      Type Parameters

      • const Header extends readonly string[]

      Parameters

      Returns AsyncIterableIterator<CSVRecord<Header>>

      Async iterable iterator of records.

      If you want array of records, use parseString.toArray function.

      import { parseString } from 'web-csv-toolbox';

      const csv = `name,age
      Alice,42
      Bob,69`;

      for await (const record of parseString(csv)) {
      console.log(record);
      }
      // Prints:
      // { name: 'Alice', age: '42' }
      // { name: 'Bob', age: '69' }
    • Parse CSV string to records.

      Type Parameters

      • const CSVSource extends string
      • const Delimiter extends string = ","
      • const Quotation extends string = "\""
      • const Header extends readonly string[] = PickCSVHeader<CSVSource, Delimiter, Quotation>

      Parameters

      Returns AsyncIterableIterator<CSVRecord<Header>>

      Async iterable iterator of records.

      If you want array of records, use parseString.toArray function.

      import { parseString } from 'web-csv-toolbox';

      const csv = `name,age
      Alice,42
      Bob,69`;

      for await (const record of parseString(csv)) {
      console.log(record);
      }
      // Prints:
      // { name: 'Alice', age: '42' }
      // { name: 'Bob', age: '69' }
    • Parse CSV string to records.

      Parameters

      • csv: string

        CSV string to parse

      • Optionaloptions: ParseOptions<readonly string[], ",", "\"">

        Parsing options. See ParseOptions.

      Returns AsyncIterableIterator<CSVRecord<string[]>>

      Async iterable iterator of records.

      If you want array of records, use parseString.toArray function.

      import { parseString } from 'web-csv-toolbox';

      const csv = `name,age
      Alice,42
      Bob,69`;

      for await (const record of parseString(csv)) {
      console.log(record);
      }
      // Prints:
      // { name: 'Alice', age: '42' }
      // { name: 'Bob', age: '69' }