Skip to content

Delimiter Discovery #400

Open
Open
@cawoodm

Description

@cawoodm

Summary

The library should detect common delimiters , or ;.

Motivation

Many international users will be working with commas or semi-colons on a daily basis depending on who generated their CSV. Currently we need to manually parse the first line and see which delimiter is used.

Alternative

let delimiter = csvString.match(/[,;]/)?.[0];
let data = csv.parse(csvString, {delimiter};

Draft

let data = csv.parse(csvString, {
  detect_delimiters: [',', ';'],
};

Additional context

Since it may be difficult to detect "just any" delimiter the developer can pass an array of common delimiters which they expect.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions