davglass / zipcodes

Zipcode lookup node module
Other
157 stars 83 forks source link

Would like a way to pull in only the primary data from the source #12

Open yawnefpark opened 7 years ago

yawnefpark commented 7 years ago

Currently looking to use this for my app however it is also returning the city name for "unacceptable" zip code matches.

One solution could be to use this link to pull in the data: http://federalgovernmentzipcodes.us/free-zipcode-database-Primary.csv

Another idea would be to update process.sh with this data

data.forEach(function(line, num) {
    line = line.split(',');
    if (line.length > 1) {
        var o = {};

        **if (clean(line[5]) === 'PRIMARY') {**

            o.zip = clean(line[1]);
            o.latitude = Number(clean(line[6]));
            o.longitude = Number(clean(line[7]));
            o.city = ucfirst(clean(line[3]));
            o.state = clean(line[4]);
            if (!zips[o.zip]) {
                zips[o.zip] = o;
            }
        **}**
    }
});

Thoughts? Thanks perogi.