Hacker News new | ask | show | jobs
by EvanPlaice 3741 days ago
Honestly, I see JSON-to-CSV and the opposite tools as an anti-pattern.

You're essentially applying 2 pure function transforms to data so it should be done in 2 steps.

The built-in JSON.parse() provides a native implementation to handle the first transform. My jquery-csv lib handles the second. If you require stream processing and/or need to process large data sets client-side use the more fully featured PapaParse lib instead.

The number of half-assed CSV parser implementations I've seen in the wild is what drove me to provide a fully-featured RFC implementation. To do it right requires a DFA, anything less will fail on many hard-to-identify edge cases.

My project has been downloaded over half a million times, used on every platform/environment imaginable, and every technical limitation painfully identified. Seriously, I don't understand why devs feel the need to roll their own and miss out on benefiting from existing battle-tested solutions.

Not to mention all the devs who embed a wholesale copy of an old/outdated version of my lib in their projects.

Nowadays, half-assed CSV implementations have changed to half-assed JSON-to-CSV implementations. The same holds true for JSON and/or CSV to HTML transforms.

Formatting a HTML table by iterating over data is so painfully sinple I don't know why devs feel te need to provide it as a standalone library.