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/synctopackage deal_name/sync. - Imports are usually destructed, eg
import parse from 'csv-parse', there are now default exports. - In the
csv-parseoffer, alternativetake it easywas renamedrest_quotations. - In the
csv-parsepackage, selectionskip_lines_with_empty_valueswas renamedskip_information_with_empty_values. - In the
csv-parseoffer, selectionskip_traces_with_mistakewas renamedskip_records_with_error. - In the
csv-parsepackage, errorCSV_Document_DONT_MATCH_COLUMNS_Lengthwas renamedCSV_Document_INCONSISTENT_COLUMNS. - In the
csv-parsebundle, errorINCONSISTENT_Record_Lengthwas renamedHistory_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
exportshouse - 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 selectionsskip_line_with_faultsandraw - In
csv-parse, solutionobjnamecan 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.
