Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter zips that start with 0, and add it if necessary. #133

Closed
wants to merge 3 commits into from

Conversation

hotdang-ca
Copy link

Solves issue #132 .

lib/utils.js Outdated
@@ -66,6 +66,14 @@ utils.cmp6 = function(a, b) {
return 0;
};

utils.filterForLeadingZeroZipCode = function(zip) {
if (/^0\d+/.test(zip)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to check for multiple leading zeroes?

var actual = geoip.lookup('76.19.11.68');
var other = geoip.lookup('66.249.79.92');

test.equal(actual.city, "Boston");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also test San Juan, PR which has zip codes 00901, 00907, 00909, 00911-00913, 00915, 00917, 00918, 00920, 00921, 00923-00927

@bluesmoon bluesmoon deleted the branch geoip-lite:master January 10, 2022 15:53
@bluesmoon bluesmoon closed this Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants