Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

csv-split-easy

codsen2.4kMIT7.0.19TypeScript support: included

Splits the CSV string into array of arrays, each representing a row of columns

add, alt, attributes, clean, email, fill, marketing, missing, newsletter, parsing, restore, tags, template, templates

readme

csv-split-easy

Splits the CSV string into array of arrays, each representing a row of columns

page on codsen.com page on npm page on github Downloads per month changelog MIT Licence

Install

This package is pure ESM. If you're not ready yet, install an older version of this program, 5.1.0 (npm i csv-split-easy@5.1.0).

npm i csv-split-easy

Quick Take

import { strict as assert } from "assert";

import { splitEasy } from "csv-split-easy";

assert.deepEqual(
  splitEasy(
    'Product Name,Main Price,Discounted Price\nTestarossa (Type F110),"100,000","90,000"\nF50,"2,500,000","1,800,000"',
  ),
  [
    ["Product Name", "Main Price", "Discounted Price"],
    ["Testarossa (Type F110)", "100000", "90000"],
    ["F50", "2500000", "1800000"],
  ],
);

Documentation

Please visit codsen.com for a full description of the API.

Contributing

To report bugs or request features or assistance, raise an issue on GitHub.

Licence

MIT License.

Copyright © 2010-2025 Roy Revelt and other contributors.

ok codsen star

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

7.0.0 (2022-12-01)

BREAKING CHANGES

  • Minimum supported Node version is v14.18; we're dropping v12 support

6.1.0 (2022-08-12)

Features

6.0.17 (2022-04-18)

Fixed

6.0.0 (2021-09-09)

Features

BREAKING CHANGES

  • programs now are in ES Modules and won't work with Common JS require()

5.1.0 (2021-05-24)

Features

  • config file based major bump blacklisting (e15f9bb)

5.0.15 (2021-04-11)

Reverts

  • Revert "chore: setup refresh" (23cf206)

5.0.1 (2021-01-28)

Fixed

  • add testStats to npmignore (f3c84e9)

5.0.0 (2021-01-23)

Features

  • rewrite in TS, start using named exports (c7b2268)

BREAKING CHANGES

  • previously: import splitEasy from ... - now import { splitEasy } from ...

4.0.0 (2020-11-28)

Accidental version bump during migration to SourceHut. Sorry about that.

3.1.0 (2020-09-27)

Features

  • rebase, split tests into separate files and add examples (18e0373)

3.0.37 (2019-10-05)

Performance Improvements

  • remove check-types-mini (4eae010)

2.6.0 (2019-01-20)

  • Various documentation and setup tweaks after we migrated to monorepo
  • Setup refresh: updated dependencies and all config files using automated tools

2.4.0 (2018-10-17)

  • Updated all dependencies
  • Restored unit test coverage tracking: reporting in terminal and coveralls.io
  • Restored unit test linting

2.3.0 (2018-06-11)

GitHub sold us out. In the meantime, we:

  • Migrated to BitBucket (to host repo + perform CI) and Codacy (for code quality audit)
  • Dropped BitHound (RIP) and Travis
  • Removed package-lock

2.2.0 (2018-05-03)

  • Set up Prettier
  • Removed package.lock and .editorconfig
  • Wired Rollup to remove comments from non-dev builds. This means we can now leave the console.logs in the source code — Rollup will remove from production code.

2.1.0 (2018-03-06)

  • PR #3 from @mac- now caters double quotes wrapping double quotes, used as a means of escaping code
  • 🔧 Updated dependencies. Rollup is continuously improving and build sizes are getting smaller.

2.0.0 (2017-11-08)

  • Rewrote in ES modules, set up the Rollup
  • Removes Standard and set up raw ESLint on airbnb-base config with semicolons off
  • Additional checks on options object

1.3.0 (2017-08-16)

  • opts.removeThousandSeparatorsFromNumbers. On by default. That's string-remove-thousand-separators (npm, GitLab) internally doing it.
  • opts.padSingleDecimalPlaceNumbers. On by default. 10.210.20.
  • opts.forceUKStyle. Off by default. 10,1510.15.

1.2.0 (2017-08-13)

  • Now algorithm skips empty rows, where each column within the row contains only empty space.

1.1.0 (2017-08-13)

  • Automatic trimming of all leading and trailing whitespace. Some IDE's (like Atom) add a trailing empty line at the end of a file. If you opened a CSV and saved it over, such IDE's would a trailing empty line. csv-split-easy automatically trims all whitespace in front and in the end of an incoming string now, so such whitespace should not be an issue now.

1.0.0 (2017-08-13)

  • First public release