Skip to content

Kripth/simple-csv-reader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple-csv-reader

npm

Converts a CSV string into a JavaScript array according to the RFC 4180 standard.

Usage

simple-csv-reader can be imported as an AMD module or globally as the readcsv function. The first argument must be a string, containing the encoded CSV. The second argument is an optional object that can be used to change the default separator using the separator key (default is ,) and the default line separator using the newLine key (default is \r\n).

This library only deserializes the input and does not perform any check on the length of the lines.

import readcsv from "simple-csv-reader";

readcsv(
`1,simple text
2,"with ""quotes"""
3,"with separator, and 
newline"`
);
[
	["1", "simple text"],
	["2", "with \"quotes\""],
	["3", "with separator, and \nnewline"]
]

About

Lightweight CSV deserializer (~1 kb)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published