From: Ardis Lu Date: Sun, 19 Oct 2025 06:39:23 +0000 (-0700) Subject: Demonstrate string shorthand X-Git-Tag: v0.1.8~5 X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=08a785461e15c91b03147569322983af9be70fde;p=csvio Demonstrate string shorthand --- diff --git a/examples/ex4_2.js b/examples/ex4_2.js index 499d85d..7764201 100644 --- a/examples/ex4_2.js +++ b/examples/ex4_2.js @@ -8,14 +8,14 @@ import { CSVReader, CSVWriter, CSVNormalizer, CSVDenormalizer, CSVTransformer } /** @import { CSVNormalizerHeader } from '../src/normalization.js'; */ // A minimal declaration to tell `CSVNormalizer` to trim empty rows and columns but otherwise don't touch the data -/** @type {Array} */ +/** @type {Array} */ const headers = [ - { name: 'columnA' }, - { name: 'columnB' }, - { name: 'columnC' }, - { name: 'sparse1' }, - { name: 'sparse2' }, - { name: 'sparse3' } + 'columnA', // Same as { name: 'columnA' } which is the same as { name: 'columnA', type: 'string' } + { name: 'columnB' }, // You can mix string and CSVNormalizerHeader in the same array + 'columnC', + 'sparse1', + 'sparse2', + 'sparse3' ]; function transform(row) {