@tabnas/csv
v0.2.0
Published
This plugin allows the [Jsonic](https://github.com/tabnas/jsonic) JSON parser to support csv syntax.
Maintainers
Readme
@tabnas/csv
A Jsonic / Tabnas syntax plugin that parses CSV text into objects or arrays, with support for headers, quoted fields, custom delimiters, streaming, and strict/non-strict modes.
|
| This open source module is sponsored and supported by Voxgig. |
| ---------------------------------------------------- | --------------------------------------------------------------------------------------- |
Install
npm install @tabnas/csv @tabnas/parser @tabnas/jsonic@tabnas/parser and @tabnas/jsonic are peer dependencies: you create
a Tabnas instance, load the jsonic grammar, then register the plugin.
One tiny example
import { Tabnas } from '@tabnas/parser'
import { jsonic } from '@tabnas/jsonic'
import { Csv } from '@tabnas/csv'
const parse = new Tabnas().use(jsonic).use(Csv)
parse.parse('name,age\nAlice,30\nBob,25') // => [{ name: 'Alice', age: '30' }, { name: 'Bob', age: '25' }]Documentation
Full documentation, in the four Diátaxis quadrants:
- Tutorial — a guided first parse.
- How-to guide — task recipes (delimiters, headers, streaming, …).
- Reference — the public API, every option, and the grammar.
- Concepts — how the plugin works on the engine, and why.
For the Go port, see ../go/doc/.
Grammar diagram
The grammar is defined in the repo-root
csv-grammar.jsonic and embedded into
src/csv.ts (and the Go port) by
embed-grammar.js during npm run build.
The live grammar as a railroad/syntax diagram, generated with
@tabnas/railroad:
A vertical ASCII version is in doc/grammar.txt.
License
Copyright (c) 2021-2025 Richard Rodger and other contributors, MIT License.
