October 15, 2024

magellan-rfid

More Computer Please

CSV package for Node.js version 6

CSV package for Node.js version 6

Edition 6 of the csv package for Node.js is launched together its sub tasks. In this article are the newest variations:

There has been a large amount of commits considering the fact that the previous deal was launched, around 100, way to a lot of to my view. Most of the endeavours were being on migrating to ECMAScript modules (ESM) and supplying a robust establish infrastructure dependent on Rollup. The site has been current and enriched with many illustrations.

Right before presenting the new features, in this article are the breaking variations to start with. Some module names have adjusted based on your qualified ecosystem. The documentation now gives comprehensive facts and samples on this matter. Also, some alternatives ended up renamed in the csv-parse package. There aren’t too numerous:

  • CommonJS end users shall update the path to the sync modules, from package deal_title/lib/sync to deal_title/sync.
  • Imports are constantly destructed, eg import parse from 'csv-parse', there are now default exports.
  • In the csv-parse package, possibility unwind was renamed rest_prices.
  • In the csv-parse package deal, selection skip_traces_with_empty_values was renamed skip_documents_with_empty_values.
  • In the csv-parse offer, choice skip_lines_with_error was renamed skip_data_with_mistake.
  • In the csv-parse package, error CSV_History_DONT_MATCH_COLUMNS_Length was renamed CSV_File_INCONSISTENT_COLUMNS.
  • In the csv-parse deal, mistake INCONSISTENT_Record_Size was renamed File_INCONSISTENT_FIELDS_Length.

Right here are the key attributes:

  • All tasks and modules are now written as ECMAScript modules.
  • Transparent utilization in between CommonJS and ESM with offer.json exports residence
  • Wrote lots of samples integrated with the documentation web page
  • Change the browser distribution with the IIFE distribution generated by Rollup
  • New UMD distribution
  • Combine lint regulations on all js and espresso documents
  • Backport compatibility with Node.js 8 in csv-stringify
  • In csv-parse, print present-day buffer with solutions skip_line_with_glitches and uncooked
  • In csv-parse, possibility objname can now refer to index place
  • A couple of TypeScript enhancements

In this article is a brief instance illustrating some of the alterations, employing the csv-parse/lib/sync module. In the earlier launch, the code seemed like:

const parse = need('csv-parse/lib/sync')
const documents = parse('a, "b" ,c', 
  chill out: real
)

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

// `parse` is now destructured, it is regular with
// `const parse = have to have('csv/sync')` if you are employing the `csv` package.
// Also, the path to the sync module is now 'csv-parse/sync'
const parse = involve('csv-parse/sync')
const information = parse('a, "b" ,c', 
  // `relax` was renamed `relax_quotes`, this is one particular of the few choices from
  // `csv-parse` which were renamed.
  relax_quotations: true
)

You should report bugs and suggest functions to the CSV repository on GitHub.