From 371f1e550e22c0b493129e142084df663d909d8b Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Thu, 17 Nov 2016 12:14:42 -0500 Subject: [PATCH] use `is2` and `is3` to avoid iterating entire country list --- sanitizer/_boundary_country.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sanitizer/_boundary_country.js b/sanitizer/_boundary_country.js index 9bdceac2..b859013e 100644 --- a/sanitizer/_boundary_country.js +++ b/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;