GithubHelp home page GithubHelp logo

parseandgen-csv's Introduction

parseandgen-csv

This is a simple CSV parser and generator module for Node.js.

Installation

To install the package, use npm:

npm install parseandgen-csv

Usage

const { parseCSV, generateCSV } = require('parseandgen-csv');

// Parse CSV data
const csvData = `Name,Age,Location
John,30,New York
Alice,25,Los Angeles
Bob,35,Chicago`;
const parsedData = parseCSV(csvData);
console.log('Parsed Data:', parsedData);

// Generate CSV data
const data = [
    { Name: 'John', Age: 30, Location: 'New York' },
    { Name: 'Alice', Age: 25, Location: 'Los Angeles' },
    { Name: 'Bob', Age: 35, Location: 'Chicago' }
];
const generatedCSV = generateCSV(data);
console.log('Generated CSV:', generatedCSV);

API

parseCSV(csvData, delimiter = ',')

Parses the given CSV data into an array of objects.

  • csvData: The CSV data to parse.
  • delimiter: (Optional) The delimiter used in the CSV data. Default is ','.

Returns an array of objects representing the CSV rows.

generateCSV(data, delimiter = ',')

Generates CSV data from an array of objects.

  • data: The array of objects to convert to CSV.
  • delimiter: (Optional) The delimiter to use in the CSV data. Default is ','.

Returns a string representing the CSV data.

License

This package is licensed under the MIT License.

parseandgen-csv's People

Contributors

panasyukmaksum avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.