bluesmoon/node-geoip — pull request #36 by elcct (2013-12-06 21:30:45+00:00)
Title: Better CSV parsing

Current method of parsing CSV files in some circumstances couldn't correctly extract needed data.

For example:

```
420399,"US","DC","Washington, D. C.","",38.8951,-77.0364,,
```

Current method of parsing:

```
line.replace(/"/g, '').split(/, */);
```

Will split
```
Washington, D. C.
```
into two fields, and as a result:

```
var lat = Math.round(parseFloat(fields[5]) * 10000);
```

lat will equal NaN and function call:

```
b.writeInt32BE(lat, 4);
```

will throw an exception, stopping the process.

Because I didn't want to reinvent the wheel, I searched on Stack Overflow for a correct solution to this problem and found this answer:

http://stackoverflow.com/questions/8493195/how-can-i-parse-a-csv-string-with-javascript

I have then incorporated CSVtoArray function into updatedb.js script and now update process is flawless.

Thanks for reading,
elcct