Last active
December 21, 2016 17:50
-
-
Save swingley/93570e8db705c87b5687dc72c9ab1e15 to your computer and use it in GitHub Desktop.
See https://gist.github.com/swingley/7938bbaf2c083f19191c0fab78783d8c for a description of what this does.
This file contains 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
var xhr = new XMLHttpRequest(); | |
xhr.addEventListener('load', function(e) { window.vaData = e.target.response; }); | |
xhr.open('get', 'data/68.json'); | |
xhr.send(); | |
vaData = JSON.parse(vaData); | |
vaData.table_data.values.forEach(function(row) { row.forEach(function(d, dIndex) { if ( d.indexOf && d.indexOf(',') > -1 ) { row[dIndex] = '"' + d + '"'; } }) }); | |
var rows = vaData.table_data.values.map(function(row) { return row.join(','); }); | |
copy(vaData.table_data.fields.join(',')); | |
// paste to gist | |
copy(rows.join('\n')); | |
// paste to gist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment