December 6, 2023


Unlimited Technology

CSV package for Node.js version 6

CSV package for Node.js version 6

Edition 6 of the csv package for Node.js is released alongside its sub jobs. Below are the latest variations:

There has been a good deal of commits since the final package deal was unveiled, all over 100, way to a lot of to my opinion. Most of the endeavours were on migrating to ECMAScript modules (ESM) and offering a strong build infrastructure based mostly on Rollup. The site has been current and enriched with numerous examples.

Prior to presenting the new features, listed here are the breaking changes to start with. Some module names have changed depending on your specific natural environment. The documentation now delivers extensive information and facts and samples on this subject matter. Also, some possibilities ended up renamed in the csv-parse deal. There are not too quite a few:

  • CommonJS end users shall update the path to the sync modules, from package deal_identify/lib/sync to package deal_title/sync.
  • Imports are generally destructed, eg import parse from 'csv-parse', there are now default exports.
  • In the csv-parse deal, selection loosen up was renamed take it easy_rates.
  • In the csv-parse bundle, possibility skip_lines_with_empty_values was renamed skip_data_with_empty_values.
  • In the csv-parse deal, option skip_strains_with_error was renamed skip_records_with_error.
  • In the csv-parse bundle, mistake CSV_History_DONT_MATCH_COLUMNS_Duration was renamed CSV_File_INCONSISTENT_COLUMNS.
  • In the csv-parse bundle, error INCONSISTENT_Report_Length was renamed File_INCONSISTENT_FIELDS_Duration.

Listed here are the key options:

  • All assignments and modules are now published as ECMAScript modules.
  • Clear usage concerning CommonJS and ESM with package deal.json exports property
  • Wrote a lot of samples integrated with the documentation internet site
  • Switch the browser distribution with the IIFE distribution produced by Rollup
  • New UMD distribution
  • Integrate lint regulations on all js and espresso documents
  • Backport compatibility with Node.js 8 in csv-stringify
  • In csv-parse, print current buffer with choices skip_line_with_glitches and raw
  • In csv-parse, option objname can now refer to index situation
  • A couple TypeScript enhancements

In this article is a speedy case in point illustrating some of the variations, utilizing the csv-parse/lib/sync module. In the previous launch, the code looked like:

const parse = involve('csv-parse/lib/sync')
const documents = parse('a, "b" ,c', 
  relax: real

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

// `parse` is now destructured, it is consistent with
// `const parse = require('csv/sync')` if you are working with the `csv` deal.
// Also, the path to the sync module is now 'csv-parse/sync'
const parse = have to have('csv-parse/sync')
const information = parse('a, "b" ,c', 
  // `relax` was renamed `relax_quotes`, this is a single of the number of choices from
  // `csv-parse` which were renamed.
  chill out_prices: accurate

Please report bugs and propose attributes to the CSV repository on GitHub.