Browse Source

Merge pull request #725 from pelias/optimize-boundary-country-sanitizer

use `is2` and `is3` to avoid iterating entire country list
pull/727/head
Stephen K Hess 8 years ago committed by GitHub
parent
commit
5f7056344f
  1. 4
      sanitizer/_boundary_country.js

4
sanitizer/_boundary_country.js

@ -34,9 +34,7 @@ function sanitize(raw, clean) {
}
function containsIsoCode(isoCode) {
return iso3166.list().some(function(row) {
return row.alpha2 === isoCode || row.alpha3 === isoCode;
});
return iso3166.is2(isoCode) || iso3166.is3(isoCode);
}
module.exports = sanitize;

Loading…
Cancel
Save