Created
October 9, 2011 20:03
-
-
Save williamhogman/1274084 to your computer and use it in GitHub Desktop.
JavaScript CSV Parser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String.prototype.parseCSV = function(delim){ | |
| return this.split("\n").map(function(r){return r.split((delim || ","))}); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It ended up as a one liner. I looked it up and Array.map has as good support as forEach so I figured we could go with it @dindresto's implementation does quoting something that this version doesn't do.