@shanzhai/convert-parsed-csv-to-struct-of-arrays-step
v0.0.11
Published
A Shanzhai step which converts a parsed CSV file to a "struct-of-arrays" format where each column is its own array.
Downloads
4
Readme
@shanzhai/convert-parsed-csv-to-struct-of-arrays-step
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).