This repository has been archived by the owner on Sep 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
country.coffee
11 lines (9 loc) · 1.86 KB
/
country.coffee
1
2
3
4
5
6
7
8
9
10
export requiresPostalCode = (code) ->
code = code.toLowerCase()
return code == 'dz' || code == 'ar' || code == 'am' || code == 'au' || code == 'at' || code == 'az' || code == 'a2' || code == 'bd' || code == 'by' || code == 'be' || code == 'ba' || code == 'br' || code == 'bn' || code == 'bg' || code == 'ca' || code == 'ic' || code == 'cn' || code == 'hr' || code == 'cy' || code == 'cz' || code == 'dk' || code == 'en' || code == 'ee' || code == 'fo' || code == 'fi' || code == 'fr' || code == 'ge' || code == 'de' || code == 'gr' || code == 'gl' || code == 'gu' || code == 'gg' || code == 'ho' || code == 'hu' || code == 'in' || code == 'id' || code == 'il' || code == 'it' || code == 'jp' || code == 'je' || code == 'kz' || code == 'kr' || code == 'ko' || code == 'kg' || code == 'lv' || code == 'li' || code == 'lt' || code == 'lu' || code == 'mk' || code == 'mg' || code == 'm3' || code == 'my' || code == 'mh' || code == 'mq' || code == 'yt' || code == 'mx' || code == 'mn' || code == 'me' || code == 'nl' || code == 'nz' || code == 'nb' || code == 'no' || code == 'pk' || code == 'ph' || code == 'pl' || code == 'po' || code == 'pt' || code == 'pr' || code == 're' || code == 'ru' || code == 'sa' || code == 'sf' || code == 'cs' || code == 'sg' || code == 'sk' || code == 'si' || code == 'za' || code == 'es' || code == 'lk' || code == 'nt' || code == 'sx' || code == 'uv' || code == 'vl' || code == 'se' || code == 'ch' || code == 'tw' || code == 'tj' || code == 'th' || code == 'tu' || code == 'tn' || code == 'tr' || code == 'tm' || code == 'vi' || code == 'ua' || code == 'gb' || code == 'us' || code == 'uy' || code == 'uz' || code == 'va' || code == 'vn' || code == 'wl' || code == 'ya'
export requiresState = (code, countries) ->
code = code.toUpperCase()
for country in countries
if country.code.toUpperCase() == code
return country.subdivisions.length > 0
return false