{"action":"created","issue":{"url":"https://api.github.com/repos/processing/p5.js/issues/548","labels_url":"https://api.github.com/repos/processing/p5.js/issues/548/labels{/name}","comments_url":"https://api.github.com/repos/processing/p5.js/issues/548/comments","events_url":"https://api.github.com/repos/processing/p5.js/issues/548/events","html_url":"https://github.com/processing/p5.js/pull/548","id":57950409,"number":548,"title":"Better loadTable function","user":{"login":"workergnome","id":34536,"avatar_url":"https://avatars.githubusercontent.com/u/34536?v=3","gravatar_id":"","url":"https://api.github.com/users/workergnome","html_url":"https://github.com/workergnome","followers_url":"https://api.github.com/users/workergnome/followers","following_url":"https://api.github.com/users/workergnome/following{/other_user}","gists_url":"https://api.github.com/users/workergnome/gists{/gist_id}","starred_url":"https://api.github.com/users/workergnome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/workergnome/subscriptions","organizations_url":"https://api.github.com/users/workergnome/orgs","repos_url":"https://api.github.com/users/workergnome/repos","events_url":"https://api.github.com/users/workergnome/events{/privacy}","received_events_url":"https://api.github.com/users/workergnome/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-17T16:59:09Z","updated_at":"2015-02-17T21:38:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/processing/p5.js/pulls/548","html_url":"https://github.com/processing/p5.js/pull/548","diff_url":"https://github.com/processing/p5.js/pull/548.diff","patch_url":"https://github.com/processing/p5.js/pull/548.patch"},"body":"I've re-written the loadTable function to handle more of the craziness that is the CSV file format.\r\n\r\nI added a couple sanity checks to the code—it now checks if you try and set it to both 'tsv' and 'csv', and will throw an error.\r\n\r\nIt's now using the `reqwest` library as opposed to raw `XMLHttpRequest`.\r\n\r\nThe actual parsing code is heavily based on https://github.com/gkindel/CSV-JS —I've taken out some of the strictness—mostly, it will now accept both windows and unix line endings, as opposed to only allowing windows (`\\r\\n`) style line feeds.  It **will** fail if you feed it CSV files with random spaces, or blank lines.\r\n\r\nI also added a bunch of new tests to the code.  I can't figure out how to test the preload functionality, and it would probably be a good idea to add some tests for TSV files, as well.  \r\n\r\nAlso, I'm currently using a link to my branch to host the test CSV file ([see link](https://github-raw-cors-proxy.herokuapp.com/workergnome/p5.js/csv_tests/test/unit/input/csv.csv)). That should probably be ported over to using the actual repository, but if I do that, the tests will fail, since the file's not actually there yet.  If this gets accepted, that's an easy fix.\r\n\r\nThis addresses issue #545 and #547."},"comment":{"url":"https://api.github.com/repos/processing/p5.js/issues/comments/74759480","html_url":"https://github.com/processing/p5.js/pull/548#issuecomment-74759480","issue_url":"https://api.github.com/repos/processing/p5.js/issues/548","id":74759480,"user":{"login":"lmccart","id":191056,"avatar_url":"https://avatars.githubusercontent.com/u/191056?v=3","gravatar_id":"","url":"https://api.github.com/users/lmccart","html_url":"https://github.com/lmccart","followers_url":"https://api.github.com/users/lmccart/followers","following_url":"https://api.github.com/users/lmccart/following{/other_user}","gists_url":"https://api.github.com/users/lmccart/gists{/gist_id}","starred_url":"https://api.github.com/users/lmccart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lmccart/subscriptions","organizations_url":"https://api.github.com/users/lmccart/orgs","repos_url":"https://api.github.com/users/lmccart/repos","events_url":"https://api.github.com/users/lmccart/events{/privacy}","received_events_url":"https://api.github.com/users/lmccart/received_events","type":"User","site_admin":false},"created_at":"2015-02-17T21:38:08Z","updated_at":"2015-02-17T21:38:08Z","body":"thanks for this @workergnome!\r\nperhaps we could add a directory on p5js.org that hosts static files for cases like this?"}}