Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
jquery-csv
Advanced tools
A jQuery CSV parser plugin. Battle Tested | Optimized | 100% IETF RFC 4180 Complete
Notice: This is a continuation of the jquery-csv project hosted on Google Code.
Javascript is growing up and HTML is finally maturing the point where webapps are being built to completely displace desktop applications. It's about time that the supporting libraries grow up too.
Looking for a complete, end-to-end, battle tested, performance optimized CSV parser that's available in the familiar jQuery syntax style? Welcome...
This library is a different creature, featuring a slim Chomsky - Type III parser implementation. Full (that means 100%) IETF RFC 4180 compliance. Including coverage for a few edge cases that even the spec fails to cover.
Enough with the wind-up...
Want to see it in action? Check out the Basic Usage Demo.
Want more? The Use Cases section below has what you need.
Aside: To the script kiddies... Don't be sad, we bet there are still plenty of people who would like to hear you outline the merits of str.split()
.
Client-Side (ie browser) - import via the script element.
<script src="jquery-csv.js"></script>
Server-Side (ie Node.js) - Import via the standard CommonJS approach.
var $ = jQuery = require('jquery');
require('./jquery.csv.js');
Each one of the methods can be called with the following form:
$.csv.function(csv, {options}, callback);
Name | Description | |
---|---|---|
csv | required | The csv data to be transformed. |
options | optional | An object containing user-defined overrides for the default options. |
callback | optional | Used for Node.js-style async callbacks. Uses the form function(err, data). |
toArray
Parse a single entry string to an array
$.csv.toArray(csv);
Documented under API#$.csv.toArray().
toArrays
Parse a multi-line CSV string to a 2D array
$.csv.toArrays(csv);
Documented under API#$.csv.toArrays().
toObjects
Parse a multi-line CSV string to an array of objects
$.csv.toObjects(csv);
Documented under API#$.csv.toObjects().
fromArrays
Convert array data to a CSV string
$.csv.fromArrays(arrays);
fromObjects
Convert an array of objects to a CSV string
$.csv.fromObjects(objects);
What fun is having a shiny new library without examples to play with?
No fun that's what... That is coming from a guy who has spent entirely too much time mucking through API documentation when he'd much rather be out at the beach, surfing, or chasing girls.
Instead of the typical useless contrived example code, I have provided a handful of simple yet powerful demos. Not only are they fun to play with but a quick peak at the source will show you how simple and easy they were to implement.
Who knows... maybe this whole 'having fun' concept may spread to some of the other Open Source libraries as a result. One can dream...
Want to play with the parser and maybe validate your CSV data without all the frills? No need to download the source first, there's a demo for that...
jQuery-CSV - Basic Usage Demonstration
Yes, you read that right. It's now possible to open local files in the browser without firing a single request to the server.
The functionality is still pretty new so not all browsers support it (I'm looking @ you IE). If that's not an issue I highly suggest you try it. It's much easier than the traditional client/server approach.
jQuery-CSV - File Handling Demonstration
Hands down, the most exciting addition to the demo collection so far...
You can input the data set using either the text area provided or via uploading CSV data files.
Want to plot 5 data sets on the same grid, no problem; Just upload 5 files containing one dataset each. The jQuery-CSV will handle the plumbing while Flot will make it all look pretty.
jQuery-CSV - Flot Demonstration
OK, I lied. This one is even cooler than Flot. Hike up your fancy pants because these things look slick.
Don't want to draw a line graph, no problem you can tap into the massive collection of different graph types available. Embedded is a fully configurable dashboard.
Warning: You may experience multiple spontaneous 'oh my got that's soo awesome' fits of excitement. Maybe even get stoked. Happens to the best us...
jQuery-CSV - Google Visualization API Demonstration
What's better than a powerful JavaScript? platform in the browser. A second, even more powerful JavaScript? platform on the server.
And... jQuery-CSV fully supports it. There is not online demo because it requires a Node.js server to run but a stub is provided to help get you started.
Dependencies:
To make this example work, you'll also need to install jQuery via the NPM.
npm install jquery
The link to the stub:
jQuery-CSV coding style is inherited from the JQuery Core Style Guidelines
by Evan Plaice
FAQs
A jQuery CSV parser plugin. Battle Tested | Optimized | 100% IETF RFC 4180 Complete
The npm package jquery-csv receives a total of 5,133 weekly downloads. As such, jquery-csv popularity was classified as popular.
We found that jquery-csv demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.