@velocitycareerlabs/csv-parser

1.21.0-dev-build.15d7e70f3 • Public • Published

csv-parser

The package contains tools for converting json to csv.

Example 1

const {parseToCsv} = require('@velocitycareerlabs/csv-parser');

const json = [
  {
    name: 'John',
    age: 30,
    city: 'New York',
  },
];

const fields = [
  {
    fieldName: 'Name',
    fieldValue: 'name',
  }
];

const csv = parseToCsv(json);

Example 2

const {parseToCsv} = require('@velocitycareerlabs/csv-parser');

const json = [
  {
    person: {
      name: 'John',
      age: 30,
      city: 'New York',
    },
  },
];

const fields = [
  {
    fieldName: 'Name',
    fieldValue: 'person.name',
  },
  {
    fieldName: 'Age',
    fieldValue: (item) => item.person.age,
  },
];

const csv = parseToCsv(json);

Readme

Keywords

none

Package Sidebar

Install

npm i @velocitycareerlabs/csv-parser

Weekly Downloads

438

Version

1.21.0-dev-build.15d7e70f3

License

Apache-2.0

Unpacked Size

16.7 kB

Total Files

6

Last publish

Collaborators

  • velocitycareerlabs