node-generate-csv
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

node-generate-csv

npm version

This package intelligently orders the export to CSV

Install as an NPM module

$ npm install node-generate-csv

Usage

import { CreateExportCSV } from 'node-generate-csv'

or

const { CreateExportCSV } = require('node-generate-csv');

How to use

Basic

interface DataType {
    year: number;
    name: string;
    hasADog?: boolean;
    hasACat?:boolean
}

const data: DataType[] = [
    {
        year: 25,
        name: "Ana"
    },
    {
        year: 50,
        name: "Thomas"
    },
    {
        year: 18,
        name: "Louise"
    },
    {
        year: 20,
        name: "Alex"
    },
    {
        year: 46,
        name: "Mark",
        hasADog: true, //Optional parameter
    },
    {
        year: 38,
        name: "Mariia",
        hasACat: false, //Optional parameter
    }
 ]

new CreateExportCSV<DataType>(data, 'tmp/testfile') //If you add a folder, you must separate it with "/" and you will find it

Output

year,name,hasADog,hasACat
25,Ana,,,
50,Thomas,,,
18,Louise,,,
20,Alex,,,
46,Mark,true,,
38,Maria,,false

Readme

Keywords

Package Sidebar

Install

npm i node-generate-csv

Weekly Downloads

0

Version

1.0.7

License

ISC

Unpacked Size

7.04 kB

Total Files

6

Last publish

Collaborators

  • codrrdev