CSV bundle for Node.js model 6

Model 6 of the csv bundle for Node.js is launched alongside its sub tasks. Listed below are the newest variations:

There was lots of commits for the reason that final bundle was launched, round 100, method to many to my opinion. Many of the efforts have been on migrating to ECMAScript modules (ESM) and offering a strong construct infrastructure based mostly on Rollup. The web site has been up to date and enriched with many examples.

Earlier than presenting the brand new options, listed below are the breaking modifications first. Some module names have modified relying in your focused setting. The documentation now supplies in depth data and samples on this matter. Additionally, some choices have been renamed within the csv-parse bundle. There aren’t too many:

  • CommonJS customers shall replace the trail to the sync modules, from package_name/lib/sync to package_name/sync.
  • Imports are at all times destructed, eg import parse from 'csv-parse', there are actually default exports.
  • Within the csv-parse bundle, possibility chill out was renamed relax_quotes.
  • Within the csv-parse bundle, possibility skip_lines_with_empty_values was renamed skip_records_with_empty_values.
  • Within the csv-parse bundle, possibility skip_lines_with_error was renamed skip_records_with_error.
  • Within the csv-parse bundle, error CSV_RECORD_DONT_MATCH_COLUMNS_LENGTH was renamed CSV_RECORD_INCONSISTENT_COLUMNS.
  • Within the csv-parse bundle, error INCONSISTENT_RECORD_LENGTH was renamed RECORD_INCONSISTENT_FIELDS_LENGTH.

Listed below are the primary options:

  • All tasks and modules are actually written as ECMAScript modules.
  • Clear utilization between CommonJS and ESM with bundle.json exports property
  • Wrote many samples built-in with the documentation web site
  • Change the browser distribution with the IIFE distribution generated by Rollup
  • New UMD distribution
  • Combine lint guidelines on all js and occasional information
  • Backport compatibility with Node.js 8 in csv-stringify
  • In csv-parse, print present buffer with choices skip_line_with_errors and uncooked
  • In csv-parse, possibility objname can now confer with index place
  • A couple of TypeScript enhancements

Here’s a fast instance illustrating a number of the modifications, utilizing the csv-parse/lib/sync module. Within the earlier launch, the code regarded like:

const parse = require('csv-parse/lib/sync');
const information = parse('a, "b" ,c', 
  chill out: true
);

Within the newest launch, the up to date code is now:




const parse = require('csv-parse/sync');
const information = parse('a, "b" ,c', 
  
  
  relax_quotes: true
);

Please report bugs and suggest options to the CSV repository on GitHub.