@shanzhai/convert-parsed-csv-to-struct-of-arrays-step
TypeScript icon, indicating that this package has built-in type declarations

0.0.11 • Public • Published

@shanzhai/convert-parsed-csv-to-struct-of-arrays-step Continuous Integration License FOSSA Status Renovate enabled npm npm type definitions

A Shanzhai step which converts a parsed CSV file to a "struct-of-arrays" format where each column is its own array.

Usage

Use ConvertParsedCsvToStructOfArraysStep to convert a parsed CSV to an object suitable for inclusion in the TypeScript global store. For example, returning the following from a trigger's event handler:

new ConvertParsedCsvToStructOfArraysStep(
  `A description of the operation being performed`,
  `aPrefixForAnyGlobals`,
  new ConstantInput([
    [`TestHeaderA`, `TestHeaderB`, `TestHeaderC`],
    [`Test Value A A`, `125`, `null`],
    [`Test Value A B`, `552`, `false`],
    [`Test Value A C`, `924`, `true`],
  ]),
  new OutputWhichReceivesConvertedCSV()
);

Would write the following to the output:

{
  aPrefixForAnyGlobalsTestHeaderA: [
    `Test Value A A`,
    `Test Value A B`,
    `Test Value A C`,
  ],
  aPrefixForAnyGlobalsTestHeaderB: [
    125,
    552,
    924,
  ],
  aPrefixForAnyGlobalsTestHeaderC: [
    null,
    false,
    true,
  ],
};

If the content of a cell is JSON-serializable, that value will be used. If this is not desirable, quote the value (effectively turning it into a JSON string).

Dependencies

This package has no runtime dependencies.

Peer Dependencies

This package has no runtime peer dependencies (it does not expect any other packages to be installed alongside itself).

License

FOSSA Status

Readme

Keywords

none

Package Sidebar

Install

npm i @shanzhai/convert-parsed-csv-to-struct-of-arrays-step

Weekly Downloads

1

Version

0.0.11

License

MIT

Unpacked Size

8.6 kB

Total Files

5

Last publish

Collaborators

  • jameswilddev