{"action":"created","issue":{"url":"https://api.github.com/repos/chaseadamsio/csvIPInfoMapper/issues/1","labels_url":"https://api.github.com/repos/chaseadamsio/csvIPInfoMapper/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/chaseadamsio/csvIPInfoMapper/issues/1/comments","events_url":"https://api.github.com/repos/chaseadamsio/csvIPInfoMapper/issues/1/events","html_url":"https://github.com/chaseadamsio/csvIPInfoMapper/pull/1","id":95328422,"number":1,"title":"Csv ip","user":{"login":"n4sa","id":7215282,"avatar_url":"https://avatars.githubusercontent.com/u/7215282?v=3","gravatar_id":"","url":"https://api.github.com/users/n4sa","html_url":"https://github.com/n4sa","followers_url":"https://api.github.com/users/n4sa/followers","following_url":"https://api.github.com/users/n4sa/following{/other_user}","gists_url":"https://api.github.com/users/n4sa/gists{/gist_id}","starred_url":"https://api.github.com/users/n4sa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n4sa/subscriptions","organizations_url":"https://api.github.com/users/n4sa/orgs","repos_url":"https://api.github.com/users/n4sa/repos","events_url":"https://api.github.com/users/n4sa/events{/privacy}","received_events_url":"https://api.github.com/users/n4sa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-16T01:51:32Z","updated_at":"2015-07-16T12:27:00Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/chaseadamsio/csvIPInfoMapper/pulls/1","html_url":"https://github.com/chaseadamsio/csvIPInfoMapper/pull/1","diff_url":"https://github.com/chaseadamsio/csvIPInfoMapper/pull/1.diff","patch_url":"https://github.com/chaseadamsio/csvIPInfoMapper/pull/1.patch"},"body":"I noticed you were using commander so I figured you wanted to make this a command line tool. I added a bin object to your package.json file and named the command \"csv-IP\".\r\n\r\nI made a mockup .csv file and noticed you had specific edge case fields like \"IPAdress\". I figured out that your program plucks that property from the csvconverter stream to fetch data from the ip-api. I ran a test on a mockup with the \"IPAdress\"  field with some dummy data and it worked except for a couple of  problems. On line 48 in program.js:\r\n\r\n```javascript\r\nfunction doSomething(jsonData) {\t\t  \r\n-    cursor++;\t\t\r\n     if (jsonData.length === cursor) {\t\t     \r\n       clearInterval(handle);\t\t       \r\n       handle = 0;\t\t       \r\n     } else {\t\t    \r\n-      getItem(jsonData[cursor]);\t\t\r\n     }\t\t     \r\n   }\t\t \r\n }\r\n```\r\nThe problem is `cursor++` is incrementing from 0 to 1 before getItem is called, this means the first iteration of getItem is going to grab data from the first index of the jsonData array, ex: `jsonData[1]`.\r\n\r\nI changed the increment to happen during the getItem function call. This fixes that problem.\r\n\r\nI also added the csv module to the package.json file, you required it in `lib/program.js`, i'm not sure if you're using it but it threw an error during npm install. I added the module to package.json so it's a dependency.\r\n\r\nI also added the mkdirp module which allows you to create a directory path with parent directories ex: `data/output`. This allows you to run the command line tool anywhere in the file system (with the exception of certain permissions). If the directory path already exists, everything is ignored.\r\n\r\nSo basically now you can run the command `csv-IP -f <.csvFile in current directory>` and it will generate a data/output directory path in the current directory with the output contents written to `data/output/IpInfo.csv`\r\n\r\nOf course for this to work, cd into the repo, `npm install` your dependencies and run `npm link` to symlink the command to your bin. You can now run `csv-IP` anywhere there is a .csv file and it will generate the output directories/file. \r\n"},"comment":{"url":"https://api.github.com/repos/chaseadamsio/csvIPInfoMapper/issues/comments/121942896","html_url":"https://github.com/chaseadamsio/csvIPInfoMapper/pull/1#issuecomment-121942896","issue_url":"https://api.github.com/repos/chaseadamsio/csvIPInfoMapper/issues/1","id":121942896,"user":{"login":"chaseadamsio","id":1024544,"avatar_url":"https://avatars.githubusercontent.com/u/1024544?v=3","gravatar_id":"","url":"https://api.github.com/users/chaseadamsio","html_url":"https://github.com/chaseadamsio","followers_url":"https://api.github.com/users/chaseadamsio/followers","following_url":"https://api.github.com/users/chaseadamsio/following{/other_user}","gists_url":"https://api.github.com/users/chaseadamsio/gists{/gist_id}","starred_url":"https://api.github.com/users/chaseadamsio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chaseadamsio/subscriptions","organizations_url":"https://api.github.com/users/chaseadamsio/orgs","repos_url":"https://api.github.com/users/chaseadamsio/repos","events_url":"https://api.github.com/users/chaseadamsio/events{/privacy}","received_events_url":"https://api.github.com/users/chaseadamsio/received_events","type":"User","site_admin":false},"created_at":"2015-07-16T12:27:00Z","updated_at":"2015-07-16T12:27:00Z","body":"Thanks for doing that. This was never meant to be anything more than a quick solution to a quick problem, but I appreciate your pull request. Would you mind updating the `README.md` to reflect your changes for how to run it?"}}