Browse Source

use `is2` and `is3` to avoid iterating entire country list

pull/725/head
Stephen Hess 8 years ago
parent
commit
371f1e550e
  1. 4
      sanitizer/_boundary_country.js

4
sanitizer/_boundary_country.js

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

Loading…
Cancel
Save