11import assertString from './util/assertString' ;
2- import includes from './util/includes' ;
32
43// from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
5- const validISO31661Alpha3CountriesCodes = [
4+ const validISO31661Alpha3CountriesCodes = new Set ( [
65 'AFG' , 'ALA' , 'ALB' , 'DZA' , 'ASM' , 'AND' , 'AGO' , 'AIA' , 'ATA' , 'ATG' , 'ARG' , 'ARM' , 'ABW' , 'AUS' , 'AUT' , 'AZE' ,
76 'BHS' , 'BHR' , 'BGD' , 'BRB' , 'BLR' , 'BEL' , 'BLZ' , 'BEN' , 'BMU' , 'BTN' , 'BOL' , 'BES' , 'BIH' , 'BWA' , 'BVT' , 'BRA' ,
87 'IOT' , 'BRN' , 'BGR' , 'BFA' , 'BDI' , 'KHM' , 'CMR' , 'CAN' , 'CPV' , 'CYM' , 'CAF' , 'TCD' , 'CHL' , 'CHN' , 'CXR' , 'CCK' ,
@@ -19,9 +18,9 @@ const validISO31661Alpha3CountriesCodes = [
1918 'ESP' , 'LKA' , 'SDN' , 'SUR' , 'SJM' , 'SWZ' , 'SWE' , 'CHE' , 'SYR' , 'TWN' , 'TJK' , 'TZA' , 'THA' , 'TLS' , 'TGO' , 'TKL' ,
2019 'TON' , 'TTO' , 'TUN' , 'TUR' , 'TKM' , 'TCA' , 'TUV' , 'UGA' , 'UKR' , 'ARE' , 'GBR' , 'USA' , 'UMI' , 'URY' , 'UZB' , 'VUT' ,
2120 'VEN' , 'VNM' , 'VGB' , 'VIR' , 'WLF' , 'ESH' , 'YEM' , 'ZMB' , 'ZWE' ,
22- ] ;
21+ ] ) ;
2322
2423export default function isISO31661Alpha3 ( str ) {
2524 assertString ( str ) ;
26- return includes ( validISO31661Alpha3CountriesCodes , str . toUpperCase ( ) ) ;
25+ return validISO31661Alpha3CountriesCodes . has ( str . toUpperCase ( ) ) ;
2726}
0 commit comments