Skip to content

ashenmagic/csv

Repository files navigation

@voidvoxel/csv

csv is designed to be a CSV analogue to the standard JSON module.

Installation

npm i @voidvoxel/csv

Importing

Module

import * as CSV from "@voidvoxel/csv";

CommonJS

const CSV = require("@voidvoxel/csv");

Usage

Parse

const csv = `animal_type,has_legs,can_fly
bird,true,true
dog,true,false
fish,false,false`;

const array = CSV.parse(csv);

console.log(array);

Stringify

const array = [
  { animal_type: 'bird', has_legs: 'true', can_fly: 'true' },
  { animal_type: 'dog', has_legs: 'true', can_fly: 'false' },
  { animal_type: 'fish', has_legs: 'false', can_fly: 'false' }
];

const csv = CSV.stringify(array);

console.log(csv);

About

CSV analogue to the standard JSON module

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published