Created
February 10, 2012 10:21
-
-
Save technovangelist/1788541 to your computer and use it in GitHub Desktop.
Convert To CSV CS
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
ConvertToCSV = (objArray,name) -> | |
array = if typeof objArray isnt "object" then JSON.parse objArray else objArray | |
str = "" | |
for item,i in array | |
line = "#{array[i]["date"]}, #{commaReplace name}" | |
for index of array[i] | |
if index isnt "date" | |
line += ", #{commaReplace array[i][index]}" | |
str += line + "\r\n" | |
str | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment