1.1.2 • Published 1 year ago

csv-document v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

CSVDocument

Introduction

CSVDocument is a library for working with CSV documents.

Installation

Install via npm:

npm install csv-document

Parsing

import { CSVDocument } from "csv-document"; 
const doc = CSVDocument.parse(csvText);

Serializing

const csvText = doc.serialize()

Editing

doc.columns = ["id", "name", "price"];
doc.entries = [
	{
		id: "0",
		name: "Apple",
		price: 1,
	},
	{
		id: "1",
		name: "Banana",
		price: 2,
	},
	{
		id: "2",
		id: "Carrot",
		price: 3,
	},
];

UTF8

const csvText = doc.serialize();
const blob = new Blob([CSVDocument.BOM.UTF8 + csvText]);

CSV Syntax

Strings:

Hello World

Numbers:

123

Number-like strings:

"123"

Strings with delimiters:

"Hello, World"

Strings with quotes:

Quote: "

Strings surrounded by quotes:

"""This string surrounded by quotes"""

License

Licensed under MIT. All files can be used for commercial or non-commercial purposes. Do not resell. Attribution is appreciated but not due.

1.1.1

1 year ago

1.1.0

1 year ago

1.1.2

1 year ago

1.0.0

2 years ago