Edition 6 of the csv offer for Node.js is produced alongside its sub projects. Listed here are the most up-to-date versions:

There has been a ton of commits given that the previous offer was unveiled, all around 100, way to a lot of to my viewpoint. Most of the initiatives had been on migrating to ECMAScript modules (ESM) and delivering a strong develop infrastructure based mostly on Rollup. The web site has been current and enriched with lots of examples.

Before presenting the new features, listed here are the breaking variations very first. Some module names have transformed dependent on your qualified environment. The documentation now delivers extensive info and samples on this subject. Also, some selections were renamed in the csv-parse package deal. There aren’t way too numerous:

  • CommonJS users shall update the route to the sync modules, from offer_identify/lib/sync to package deal_name/sync.
  • Imports are usually destructed, eg import parse from 'csv-parse', there are now default exports.
  • In the csv-parse offer, alternative take it easy was renamed rest_quotations.
  • In the csv-parse package, selection skip_lines_with_empty_values was renamed skip_information_with_empty_values.
  • In the csv-parse offer, selection skip_traces_with_mistake was renamed skip_records_with_error.
  • In the csv-parse package, error CSV_Document_DONT_MATCH_COLUMNS_Length was renamed CSV_Document_INCONSISTENT_COLUMNS.
  • In the csv-parse bundle, error INCONSISTENT_Record_Length was renamed History_INCONSISTENT_FIELDS_Length.

Listed here are the key capabilities:

  • All projects and modules are now published as ECMAScript modules.
  • Clear use among CommonJS and ESM with package deal.json exports house
  • Wrote a lot of samples built-in with the documentation website
  • Switch the browser distribution with the IIFE distribution created by Rollup
  • New UMD distribution
  • Combine lint policies on all js and coffee documents
  • Backport compatibility with Node.js 8 in csv-stringify
  • In csv-parse, print present-day buffer with selections skip_line_with_faults and raw
  • In csv-parse, solution objname can now refer to index situation
  • A few TypeScript enhancements

Below is a swift case in point illustrating some of the variations, working with the csv-parse/lib/sync module. In the prior release, the code seemed like:

const parse = call for('csv-parse/lib/sync')
const data = parse('a, "b" ,c', 
  relax: genuine
)

In the most current launch, the up-to-date code is now:


const parse = involve('csv-parse/sync')
const records = parse('a, "b" ,c', 
  chill out_offers: genuine
)

Be sure to report bugs and suggest characteristics to the CSV repository on GitHub.