adapter system
a-csv
CSV capability pack: parse CSV text into row-objects (RFC-4180-ish, quoted fields), stringify objects/arrays back to CSV, convert CSV to a JSON array, or preview the first N rows. Dependency-free.
a-csv (adapter system)
CSV capability pack. The source leumas-middleware/lib/a.csv shipped only a placeholder CRUD express server (runAdapter was a stub with no concrete CSV logic), so this port provides a lightweight, dependency-free core built to the same contract. Stripped: server.js, public/, helpers/, docs/.
Tools (adapters)
| tool | args | result | |
|---|---|---|---|
parse | { input, delimiter?, header? } | { headers, rows, count } (row-objects; header:false → array rows) | |
stringify | `{ input: [{...}] \ | [[...]], delimiter?, headers? }` | { output, count } |
toJSON | { input, delimiter? } | array of row-objects | |
preview | { input, limit?, delimiter? } | { headers, rows, total } |
The parser is RFC-4180-ish: it handles quoted fields, escaped quotes (""), embedded commas / newlines, and CRLF line endings. stringify quotes cells containing the delimiter, quotes, or line breaks. Zero external dependencies.