{"action":"created","issue":{"url":"https://api.github.com/repos/wdavidw/node-csv-parse/issues/56","repository_url":"https://api.github.com/repos/wdavidw/node-csv-parse","labels_url":"https://api.github.com/repos/wdavidw/node-csv-parse/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/wdavidw/node-csv-parse/issues/56/comments","events_url":"https://api.github.com/repos/wdavidw/node-csv-parse/issues/56/events","html_url":"https://github.com/wdavidw/node-csv-parse/issues/56","id":98004132,"number":56,"title":"Read ints with leading zeroes as string","user":{"login":"petermanser","id":292951,"avatar_url":"https://avatars.githubusercontent.com/u/292951?v=3","gravatar_id":"","url":"https://api.github.com/users/petermanser","html_url":"https://github.com/petermanser","followers_url":"https://api.github.com/users/petermanser/followers","following_url":"https://api.github.com/users/petermanser/following{/other_user}","gists_url":"https://api.github.com/users/petermanser/gists{/gist_id}","starred_url":"https://api.github.com/users/petermanser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petermanser/subscriptions","organizations_url":"https://api.github.com/users/petermanser/orgs","repos_url":"https://api.github.com/users/petermanser/repos","events_url":"https://api.github.com/users/petermanser/events{/privacy}","received_events_url":"https://api.github.com/users/petermanser/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2015-07-29T18:50:39Z","updated_at":"2016-08-04T16:40:56Z","closed_at":null,"body":"Looks like the parsing of ints with leading zeroes as string doesn't work.\r\n\r\n```CoffeeScript\r\nif (@options.auto_parse and @regexp_int.test(@field))\r\n    @line.push parseInt(@field)\r\nelse if (@options.auto_parse and @regexp_float.test(@field))\r\n    @line.push parseFloat(@field)\r\n```\r\n\r\nSince the dot in the tested text is optional, it does also match strings like `01`.\r\n```\r\n/^(\\-|\\+)?([0-9]+(\\.[0-9]+)?([eE][0-9]+)?|Infinity)$/\r\n```\r\n\r\nI think the dot should be not be optional, since we've tested for ints before. Or if still wanted, a leading `0` should only be allowed if it's followed by a `.`.\r\n\r\nI'm not sure why this test works:\r\nhttps://github.com/wdavidw/node-csv-parse/blob/master/test/options.auto_parse.coffee#L53\r\n\r\n\r\nWhat do you think?\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/wdavidw/node-csv-parse/issues/comments/237610701","html_url":"https://github.com/wdavidw/node-csv-parse/issues/56#issuecomment-237610701","issue_url":"https://api.github.com/repos/wdavidw/node-csv-parse/issues/56","id":237610701,"user":{"login":"kevinob11","id":4147929,"avatar_url":"https://avatars.githubusercontent.com/u/4147929?v=3","gravatar_id":"","url":"https://api.github.com/users/kevinob11","html_url":"https://github.com/kevinob11","followers_url":"https://api.github.com/users/kevinob11/followers","following_url":"https://api.github.com/users/kevinob11/following{/other_user}","gists_url":"https://api.github.com/users/kevinob11/gists{/gist_id}","starred_url":"https://api.github.com/users/kevinob11/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevinob11/subscriptions","organizations_url":"https://api.github.com/users/kevinob11/orgs","repos_url":"https://api.github.com/users/kevinob11/repos","events_url":"https://api.github.com/users/kevinob11/events{/privacy}","received_events_url":"https://api.github.com/users/kevinob11/received_events","type":"User","site_admin":false},"created_at":"2016-08-04T16:40:56Z","updated_at":"2016-08-04T16:40:56Z","body":"According to [this stack overflow](http://stackoverflow.com/questions/34595812/is-a-csv-with-equal-sign-valid) a common (I've tested this works in excel and google drive) way of handling leading zeros is to put an equals sign before the initial quote for the field (EG `=\"01234\"`).\r\n\r\nI ran into this because Amazon Order Reporting was feeding me back a csv that contained equals signs before the initial quote in a few fields. I worked around it by removing them for now prior to parsing since I'm not parsing int anyway, but would properly implementing this \"standard\" be a good idea? Currently the parser chokes on those equals signs and errors out."}}
{"actor":{"display_login":"kevinob11"}}