national-metadata 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/LICENSE +661 -21
  2. package/README.md +485 -41
  3. package/dist/cities/city-country-slugs.d.ts +2 -0
  4. package/dist/cities/city-country-slugs.d.ts.map +1 -0
  5. package/dist/cities/city-country-slugs.js +1346 -0
  6. package/dist/cities/city-country-slugs.js.map +1 -0
  7. package/dist/cities/city-slugs.d.ts +2 -0
  8. package/dist/cities/city-slugs.d.ts.map +1 -0
  9. package/dist/cities/city-slugs.js +1343 -0
  10. package/dist/cities/city-slugs.js.map +1 -0
  11. package/dist/code-to-country.js +1 -4
  12. package/dist/code-to-country.js.map +1 -1
  13. package/dist/country-name-strings.js +1 -4
  14. package/dist/country-name-strings.js.map +1 -1
  15. package/dist/country-to-code.d.ts.map +1 -1
  16. package/dist/country-to-code.js +3 -4
  17. package/dist/country-to-code.js.map +1 -1
  18. package/dist/flag-svg/AC.svg +1 -0
  19. package/dist/flag-svg/AD.svg +1 -0
  20. package/dist/flag-svg/AE.svg +1 -0
  21. package/dist/flag-svg/AF.svg +1 -0
  22. package/dist/flag-svg/AG.svg +1 -0
  23. package/dist/flag-svg/AI.svg +1 -0
  24. package/dist/flag-svg/AL.svg +1 -0
  25. package/dist/flag-svg/AM.svg +1 -0
  26. package/dist/flag-svg/AO.svg +1 -0
  27. package/dist/flag-svg/AQ.svg +1 -0
  28. package/dist/flag-svg/AR.svg +1 -0
  29. package/dist/flag-svg/AS.svg +1 -0
  30. package/dist/flag-svg/AT.svg +1 -0
  31. package/dist/flag-svg/AU.svg +1 -0
  32. package/dist/flag-svg/AW.svg +1 -0
  33. package/dist/flag-svg/AX.svg +1 -0
  34. package/dist/flag-svg/AZ.svg +1 -0
  35. package/dist/flag-svg/BA.svg +1 -0
  36. package/dist/flag-svg/BB.svg +1 -0
  37. package/dist/flag-svg/BD.svg +1 -0
  38. package/dist/flag-svg/BE.svg +1 -0
  39. package/dist/flag-svg/BF.svg +1 -0
  40. package/dist/flag-svg/BG.svg +1 -0
  41. package/dist/flag-svg/BH.svg +1 -0
  42. package/dist/flag-svg/BI.svg +1 -0
  43. package/dist/flag-svg/BJ.svg +1 -0
  44. package/dist/flag-svg/BL.svg +1 -0
  45. package/dist/flag-svg/BM.svg +1 -0
  46. package/dist/flag-svg/BN.svg +1 -0
  47. package/dist/flag-svg/BO.svg +1 -0
  48. package/dist/flag-svg/BQ.svg +1 -0
  49. package/dist/flag-svg/BR.svg +1 -0
  50. package/dist/flag-svg/BS.svg +1 -0
  51. package/dist/flag-svg/BT.svg +1 -0
  52. package/dist/flag-svg/BV.svg +1 -0
  53. package/dist/flag-svg/BW.svg +1 -0
  54. package/dist/flag-svg/BY.svg +1 -0
  55. package/dist/flag-svg/BZ.svg +1 -0
  56. package/dist/flag-svg/CA.svg +1 -0
  57. package/dist/flag-svg/CC.svg +1 -0
  58. package/dist/flag-svg/CD.svg +1 -0
  59. package/dist/flag-svg/CF.svg +1 -0
  60. package/dist/flag-svg/CG.svg +1 -0
  61. package/dist/flag-svg/CH.svg +1 -0
  62. package/dist/flag-svg/CI.svg +1 -0
  63. package/dist/flag-svg/CK.svg +1 -0
  64. package/dist/flag-svg/CL.svg +1 -0
  65. package/dist/flag-svg/CM.svg +1 -0
  66. package/dist/flag-svg/CN.svg +1 -0
  67. package/dist/flag-svg/CO.svg +1 -0
  68. package/dist/flag-svg/CR.svg +1 -0
  69. package/dist/flag-svg/CU.svg +1 -0
  70. package/dist/flag-svg/CV.svg +1 -0
  71. package/dist/flag-svg/CW.svg +1 -0
  72. package/dist/flag-svg/CX.svg +1 -0
  73. package/dist/flag-svg/CY.svg +1 -0
  74. package/dist/flag-svg/CZ.svg +1 -0
  75. package/dist/flag-svg/DE.svg +1 -0
  76. package/dist/flag-svg/DJ.svg +1 -0
  77. package/dist/flag-svg/DK.svg +1 -0
  78. package/dist/flag-svg/DM.svg +1 -0
  79. package/dist/flag-svg/DO.svg +1 -0
  80. package/dist/flag-svg/DZ.svg +1 -0
  81. package/dist/flag-svg/EC.svg +1 -0
  82. package/dist/flag-svg/EE.svg +1 -0
  83. package/dist/flag-svg/EG.svg +1 -0
  84. package/dist/flag-svg/EH.svg +1 -0
  85. package/dist/flag-svg/ER.svg +1 -0
  86. package/dist/flag-svg/ES.svg +1 -0
  87. package/dist/flag-svg/ET.svg +1 -0
  88. package/dist/flag-svg/EU.svg +1 -0
  89. package/dist/flag-svg/FI.svg +1 -0
  90. package/dist/flag-svg/FJ.svg +1 -0
  91. package/dist/flag-svg/FK.svg +1 -0
  92. package/dist/flag-svg/FM.svg +1 -0
  93. package/dist/flag-svg/FO.svg +1 -0
  94. package/dist/flag-svg/FR.svg +1 -0
  95. package/dist/flag-svg/GA.svg +1 -0
  96. package/dist/flag-svg/GB.svg +1 -0
  97. package/dist/flag-svg/GD.svg +1 -0
  98. package/dist/flag-svg/GE-AB.svg +1 -0
  99. package/dist/flag-svg/GE-OS.svg +1 -0
  100. package/dist/flag-svg/GE.svg +1 -0
  101. package/dist/flag-svg/GF.svg +1 -0
  102. package/dist/flag-svg/GG.svg +1 -0
  103. package/dist/flag-svg/GH.svg +1 -0
  104. package/dist/flag-svg/GI.svg +1 -0
  105. package/dist/flag-svg/GL.svg +1 -0
  106. package/dist/flag-svg/GM.svg +1 -0
  107. package/dist/flag-svg/GN.svg +1 -0
  108. package/dist/flag-svg/GP.svg +1 -0
  109. package/dist/flag-svg/GQ.svg +1 -0
  110. package/dist/flag-svg/GR.svg +1 -0
  111. package/dist/flag-svg/GS.svg +1 -0
  112. package/dist/flag-svg/GT.svg +1 -0
  113. package/dist/flag-svg/GU.svg +1 -0
  114. package/dist/flag-svg/GW.svg +1 -0
  115. package/dist/flag-svg/GY.svg +1 -0
  116. package/dist/flag-svg/HK.svg +1 -0
  117. package/dist/flag-svg/HM.svg +1 -0
  118. package/dist/flag-svg/HN.svg +1 -0
  119. package/dist/flag-svg/HR.svg +1 -0
  120. package/dist/flag-svg/HT.svg +1 -0
  121. package/dist/flag-svg/HU.svg +1 -0
  122. package/dist/flag-svg/IC.svg +1 -0
  123. package/dist/flag-svg/ID.svg +1 -0
  124. package/dist/flag-svg/IE.svg +1 -0
  125. package/dist/flag-svg/IL.svg +1 -0
  126. package/dist/flag-svg/IM.svg +1 -0
  127. package/dist/flag-svg/IN.svg +1 -0
  128. package/dist/flag-svg/IO.svg +1 -0
  129. package/dist/flag-svg/IQ.svg +1 -0
  130. package/dist/flag-svg/IR.svg +1 -0
  131. package/dist/flag-svg/IS.svg +1 -0
  132. package/dist/flag-svg/IT.svg +1 -0
  133. package/dist/flag-svg/JE.svg +1 -0
  134. package/dist/flag-svg/JM.svg +1 -0
  135. package/dist/flag-svg/JO.svg +1 -0
  136. package/dist/flag-svg/JP.svg +1 -0
  137. package/dist/flag-svg/KE.svg +1 -0
  138. package/dist/flag-svg/KG.svg +1 -0
  139. package/dist/flag-svg/KH.svg +1 -0
  140. package/dist/flag-svg/KI.svg +1 -0
  141. package/dist/flag-svg/KM.svg +1 -0
  142. package/dist/flag-svg/KN.svg +1 -0
  143. package/dist/flag-svg/KP.svg +1 -0
  144. package/dist/flag-svg/KR.svg +1 -0
  145. package/dist/flag-svg/KW.svg +1 -0
  146. package/dist/flag-svg/KY.svg +1 -0
  147. package/dist/flag-svg/KZ.svg +1 -0
  148. package/dist/flag-svg/LA.svg +1 -0
  149. package/dist/flag-svg/LB.svg +1 -0
  150. package/dist/flag-svg/LC.svg +1 -0
  151. package/dist/flag-svg/LI.svg +1 -0
  152. package/dist/flag-svg/LK.svg +1 -0
  153. package/dist/flag-svg/LR.svg +1 -0
  154. package/dist/flag-svg/LS.svg +1 -0
  155. package/dist/flag-svg/LT.svg +1 -0
  156. package/dist/flag-svg/LU.svg +1 -0
  157. package/dist/flag-svg/LV.svg +1 -0
  158. package/dist/flag-svg/LY.svg +1 -0
  159. package/dist/flag-svg/MA.svg +1 -0
  160. package/dist/flag-svg/MC.svg +1 -0
  161. package/dist/flag-svg/MD.svg +1 -0
  162. package/dist/flag-svg/ME.svg +1 -0
  163. package/dist/flag-svg/MF.svg +1 -0
  164. package/dist/flag-svg/MG.svg +1 -0
  165. package/dist/flag-svg/MH.svg +1 -0
  166. package/dist/flag-svg/MK.svg +1 -0
  167. package/dist/flag-svg/ML.svg +1 -0
  168. package/dist/flag-svg/MM.svg +1 -0
  169. package/dist/flag-svg/MN.svg +1 -0
  170. package/dist/flag-svg/MO.svg +1 -0
  171. package/dist/flag-svg/MP.svg +1 -0
  172. package/dist/flag-svg/MQ.svg +1 -0
  173. package/dist/flag-svg/MR.svg +1 -0
  174. package/dist/flag-svg/MS.svg +1 -0
  175. package/dist/flag-svg/MT.svg +1 -0
  176. package/dist/flag-svg/MU.svg +1 -0
  177. package/dist/flag-svg/MV.svg +1 -0
  178. package/dist/flag-svg/MW.svg +1 -0
  179. package/dist/flag-svg/MX.svg +1 -0
  180. package/dist/flag-svg/MY.svg +1 -0
  181. package/dist/flag-svg/MZ.svg +1 -0
  182. package/dist/flag-svg/NA.svg +1 -0
  183. package/dist/flag-svg/NC.svg +1 -0
  184. package/dist/flag-svg/NE.svg +1 -0
  185. package/dist/flag-svg/NF.svg +1 -0
  186. package/dist/flag-svg/NG.svg +1 -0
  187. package/dist/flag-svg/NI.svg +1 -0
  188. package/dist/flag-svg/NL.svg +1 -0
  189. package/dist/flag-svg/NO.svg +1 -0
  190. package/dist/flag-svg/NP.svg +1 -0
  191. package/dist/flag-svg/NR.svg +1 -0
  192. package/dist/flag-svg/NU.svg +1 -0
  193. package/dist/flag-svg/NZ.svg +1 -0
  194. package/dist/flag-svg/OM.svg +1 -0
  195. package/dist/flag-svg/PA.svg +1 -0
  196. package/dist/flag-svg/PE.svg +1 -0
  197. package/dist/flag-svg/PF.svg +1 -0
  198. package/dist/flag-svg/PG.svg +1 -0
  199. package/dist/flag-svg/PH.svg +1 -0
  200. package/dist/flag-svg/PK.svg +1 -0
  201. package/dist/flag-svg/PL.svg +1 -0
  202. package/dist/flag-svg/PM.svg +1 -0
  203. package/dist/flag-svg/PN.svg +1 -0
  204. package/dist/flag-svg/PR.svg +1 -0
  205. package/dist/flag-svg/PS.svg +1 -0
  206. package/dist/flag-svg/PT.svg +1 -0
  207. package/dist/flag-svg/PW.svg +1 -0
  208. package/dist/flag-svg/PY.svg +1 -0
  209. package/dist/flag-svg/QA.svg +1 -0
  210. package/dist/flag-svg/RE.svg +1 -0
  211. package/dist/flag-svg/RO.svg +1 -0
  212. package/dist/flag-svg/RS.svg +1 -0
  213. package/dist/flag-svg/RU.svg +1 -0
  214. package/dist/flag-svg/RW.svg +1 -0
  215. package/dist/flag-svg/SA.svg +1 -0
  216. package/dist/flag-svg/SB.svg +1 -0
  217. package/dist/flag-svg/SC.svg +1 -0
  218. package/dist/flag-svg/SD.svg +1 -0
  219. package/dist/flag-svg/SE.svg +1 -0
  220. package/dist/flag-svg/SG.svg +1 -0
  221. package/dist/flag-svg/SH.svg +1 -0
  222. package/dist/flag-svg/SI.svg +1 -0
  223. package/dist/flag-svg/SJ.svg +1 -0
  224. package/dist/flag-svg/SK.svg +1 -0
  225. package/dist/flag-svg/SL.svg +1 -0
  226. package/dist/flag-svg/SM.svg +1 -0
  227. package/dist/flag-svg/SN.svg +1 -0
  228. package/dist/flag-svg/SO.svg +1 -0
  229. package/dist/flag-svg/SR.svg +1 -0
  230. package/dist/flag-svg/SS.svg +1 -0
  231. package/dist/flag-svg/ST.svg +1 -0
  232. package/dist/flag-svg/SV.svg +1 -0
  233. package/dist/flag-svg/SX.svg +1 -0
  234. package/dist/flag-svg/SY.svg +1 -0
  235. package/dist/flag-svg/SZ.svg +1 -0
  236. package/dist/flag-svg/TA.svg +1 -0
  237. package/dist/flag-svg/TC.svg +1 -0
  238. package/dist/flag-svg/TD.svg +1 -0
  239. package/dist/flag-svg/TF.svg +1 -0
  240. package/dist/flag-svg/TG.svg +1 -0
  241. package/dist/flag-svg/TH.svg +1 -0
  242. package/dist/flag-svg/TJ.svg +1 -0
  243. package/dist/flag-svg/TK.svg +1 -0
  244. package/dist/flag-svg/TL.svg +1 -0
  245. package/dist/flag-svg/TM.svg +1 -0
  246. package/dist/flag-svg/TN.svg +1 -0
  247. package/dist/flag-svg/TO.svg +1 -0
  248. package/dist/flag-svg/TR.svg +1 -0
  249. package/dist/flag-svg/TT.svg +1 -0
  250. package/dist/flag-svg/TV.svg +1 -0
  251. package/dist/flag-svg/TW.svg +1 -0
  252. package/dist/flag-svg/TZ.svg +1 -0
  253. package/dist/flag-svg/UA.svg +1 -0
  254. package/dist/flag-svg/UG.svg +1 -0
  255. package/dist/flag-svg/UM.svg +1 -0
  256. package/dist/flag-svg/US.svg +1 -0
  257. package/dist/flag-svg/UY.svg +1 -0
  258. package/dist/flag-svg/UZ.svg +1 -0
  259. package/dist/flag-svg/VA.svg +1 -0
  260. package/dist/flag-svg/VC.svg +1 -0
  261. package/dist/flag-svg/VE.svg +1 -0
  262. package/dist/flag-svg/VG.svg +1 -0
  263. package/dist/flag-svg/VI.svg +1 -0
  264. package/dist/flag-svg/VN.svg +1 -0
  265. package/dist/flag-svg/VU.svg +1 -0
  266. package/dist/flag-svg/WF.svg +1 -0
  267. package/dist/flag-svg/WS.svg +1 -0
  268. package/dist/flag-svg/XK.svg +1 -0
  269. package/dist/flag-svg/YE.svg +1 -0
  270. package/dist/flag-svg/YT.svg +1 -0
  271. package/dist/flag-svg/ZA.svg +1 -0
  272. package/dist/flag-svg/ZM.svg +1 -0
  273. package/dist/flag-svg/ZW.svg +1 -0
  274. package/dist/flags.d.ts +27 -0
  275. package/dist/flags.d.ts.map +1 -0
  276. package/dist/flags.js +289 -0
  277. package/dist/flags.js.map +1 -0
  278. package/dist/immigration/visa-travel.d.ts +9 -0
  279. package/dist/immigration/visa-travel.d.ts.map +1 -0
  280. package/dist/immigration/visa-travel.js +36963 -0
  281. package/dist/immigration/visa-travel.js.map +1 -0
  282. package/dist/index.d.ts +31 -11
  283. package/dist/index.d.ts.map +1 -1
  284. package/dist/index.js +80 -43
  285. package/dist/index.js.map +1 -1
  286. package/dist/list-of-countries.js +2 -5
  287. package/dist/list-of-countries.js.map +1 -1
  288. package/dist/mercator-hash.js +2 -5
  289. package/dist/mercator-hash.js.map +1 -1
  290. package/dist/rankings/legatum_2023.d.ts +18 -0
  291. package/dist/rankings/legatum_2023.d.ts.map +1 -0
  292. package/dist/rankings/legatum_2023.js +2675 -0
  293. package/dist/rankings/legatum_2023.js.map +1 -0
  294. package/dist/three-to-two.js +1 -4
  295. package/dist/three-to-two.js.map +1 -1
  296. package/dist/two-to-three.js +1 -4
  297. package/dist/two-to-three.js.map +1 -1
  298. package/package.json +29 -6
package/README.md CHANGED
@@ -1,24 +1,28 @@
1
- # 🌍 Jiang Hu
1
+ # 🌍 National Metadata
2
2
 
3
3
  The internet's most helpful npm package for comprehensive country data, including utility functions to help work with ISO codes, names, continents, and mercator coordinates.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install jiang-hu
8
+ npm install national-metadata
9
9
  ```
10
10
 
11
11
  ## Quick Start
12
12
 
13
13
  ```typescript
14
- import { helloWorld, getCountryNameFromCode, convertTwoToThree } from 'jiang-hu';
14
+ import {
15
+ helloWorld,
16
+ getCountryNameFromCode,
17
+ convertTwoToThree,
18
+ } from "national-metadata";
15
19
 
16
20
  // Hello World function
17
21
  console.log(helloWorld()); // "Mr World Wide is here"
18
22
 
19
23
  // Convert ISO codes
20
- console.log(getCountryNameFromCode('US')); // "United States"
21
- console.log(convertTwoToThree('US')); // "USA"
24
+ console.log(getCountryNameFromCode("US")); // "United States"
25
+ console.log(convertTwoToThree("US")); // "USA"
22
26
  ```
23
27
 
24
28
  ## API Reference
@@ -28,66 +32,73 @@ console.log(convertTwoToThree('US')); // "USA"
28
32
  ```typescript
29
33
  helloWorld(): string
30
34
  ```
35
+
31
36
  Returns the signature greeting: "Mr World Wide is here"
32
37
 
33
38
  ### Country Code Conversion
34
39
 
35
40
  #### `convertTwoToThree(twoDigitCode: string): string | undefined`
41
+
36
42
  Converts 2-digit ISO country codes to 3-digit codes.
37
43
 
38
44
  ```typescript
39
- convertTwoToThree('US'); // "USA"
40
- convertTwoToThree('GB'); // "GBR"
41
- convertTwoToThree('DE'); // "DEU"
45
+ convertTwoToThree("US"); // "USA"
46
+ convertTwoToThree("GB"); // "GBR"
47
+ convertTwoToThree("DE"); // "DEU"
42
48
  ```
43
49
 
44
50
  #### `convertThreeToTwo(threeDigitCode: string): string | undefined`
51
+
45
52
  Converts 3-digit ISO country codes to 2-digit codes.
46
53
 
47
54
  ```typescript
48
- convertThreeToTwo('USA'); // "US"
49
- convertThreeToTwo('GBR'); // "GB"
50
- convertThreeToTwo('DEU'); // "DE"
55
+ convertThreeToTwo("USA"); // "US"
56
+ convertThreeToTwo("GBR"); // "GB"
57
+ convertThreeToTwo("DEU"); // "DE"
51
58
  ```
52
59
 
53
60
  ### Country Name Functions
54
61
 
55
62
  #### `getCountryNameFromCode(code: string): string | undefined`
63
+
56
64
  Gets country name from 2-digit ISO code.
57
65
 
58
66
  ```typescript
59
- getCountryNameFromCode('US'); // "United States"
60
- getCountryNameFromCode('FR'); // "France"
61
- getCountryNameFromCode('JP'); // "Japan"
67
+ getCountryNameFromCode("US"); // "United States"
68
+ getCountryNameFromCode("FR"); // "France"
69
+ getCountryNameFromCode("JP"); // "Japan"
62
70
  ```
63
71
 
64
72
  #### `getCountryCodeFromName(countryName: string): string | undefined`
73
+
65
74
  Gets 2-digit ISO code from country name.
66
75
 
67
76
  ```typescript
68
- getCountryCodeFromName('United States'); // "US"
69
- getCountryCodeFromName('France'); // "FR"
70
- getCountryCodeFromName('Japan'); // "JP"
77
+ getCountryCodeFromName("United States"); // "US"
78
+ getCountryCodeFromName("France"); // "FR"
79
+ getCountryCodeFromName("Japan"); // "JP"
71
80
  ```
72
81
 
73
82
  ### Geographic Data
74
83
 
75
84
  #### `getMercatorCoordinates(threeDigitCode: string): [number, number] | undefined`
85
+
76
86
  Gets mercator coordinates [longitude, latitude] for a country.
77
87
 
78
88
  ```typescript
79
- getMercatorCoordinates('USA'); // [-95.71, 37.09]
80
- getMercatorCoordinates('GBR'); // [-3.48, 52.35]
81
- getMercatorCoordinates('JPN'); // [139.75, 35.68]
89
+ getMercatorCoordinates("USA"); // [-95.71, 37.09]
90
+ getMercatorCoordinates("GBR"); // [-3.48, 52.35]
91
+ getMercatorCoordinates("JPN"); // [139.75, 35.68]
82
92
  ```
83
93
 
84
94
  #### `getCountrySizeScale(threeDigitCode: string): number | undefined`
95
+
85
96
  Gets the size scale factor for map visualization.
86
97
 
87
98
  ```typescript
88
- getCountrySizeScale('USA'); // 300
89
- getCountrySizeScale('GBR'); // 800
90
- getCountrySizeScale('MCO'); // 2500 (Monaco - smaller countries have higher scale)
99
+ getCountrySizeScale("USA"); // 300
100
+ getCountrySizeScale("GBR"); // 800
101
+ getCountrySizeScale("MCO"); // 2500 (Monaco - smaller countries have higher scale)
91
102
  ```
92
103
 
93
104
  ## Data Exports
@@ -95,7 +106,7 @@ getCountrySizeScale('MCO'); // 2500 (Monaco - smaller countries have higher scal
95
106
  ### Raw Data Objects
96
107
 
97
108
  ```typescript
98
- import {
109
+ import {
99
110
  code_to_country,
100
111
  country_to_code,
101
112
  list_of_countries,
@@ -103,27 +114,30 @@ import {
103
114
  mercator_hash,
104
115
  countrySizeScales,
105
116
  twoToThree,
106
- threeToTwo
107
- } from 'jiang-hu';
117
+ threeToTwo,
118
+ } from "national-metadata";
108
119
  ```
109
120
 
110
121
  #### `code_to_country`
122
+
111
123
  Object mapping 2-digit ISO codes to country names.
112
124
 
113
125
  ```typescript
114
- code_to_country['US']; // "United States"
115
- code_to_country['GB']; // "United Kingdom"
126
+ code_to_country["US"]; // "United States"
127
+ code_to_country["GB"]; // "United Kingdom"
116
128
  ```
117
129
 
118
130
  #### `country_to_code`
131
+
119
132
  Object mapping country names to 2-digit ISO codes.
120
133
 
121
134
  ```typescript
122
- country_to_code['United States']; // "US"
123
- country_to_code['United Kingdom']; // "UK"
135
+ country_to_code["United States"]; // "US"
136
+ country_to_code["United Kingdom"]; // "UK"
124
137
  ```
125
138
 
126
139
  #### `list_of_countries`
140
+
127
141
  Array of country objects with ISO code, name, and continent.
128
142
 
129
143
  ```typescript
@@ -136,6 +150,7 @@ Array of country objects with ISO code, name, and continent.
136
150
  ```
137
151
 
138
152
  #### `country_name_strings`
153
+
139
154
  Simple array of country names.
140
155
 
141
156
  ```typescript
@@ -143,33 +158,183 @@ Simple array of country names.
143
158
  ```
144
159
 
145
160
  #### `mercator_hash`
161
+
146
162
  Object mapping 3-digit ISO codes to [longitude, latitude] coordinates.
147
163
 
148
164
  ```typescript
149
- mercator_hash['USA']; // [-95.71, 37.09]
165
+ mercator_hash["USA"]; // [-95.71, 37.09]
150
166
  ```
151
167
 
152
168
  #### `countrySizeScales`
169
+
153
170
  Object mapping 3-digit ISO codes to size scale factors for visualization.
154
171
 
155
172
  ```typescript
156
- countrySizeScales['USA']; // 300
173
+ countrySizeScales["USA"]; // 300
174
+ ```
175
+
176
+ ## 🚩 Flag SVGs
177
+
178
+ National Metadata now includes high-quality SVG flags for all countries! The package exports flag utilities and includes all SVG files, optimized for web applications.
179
+
180
+ ### Flag Functions
181
+
182
+ #### `getFlagPath(countryCode: string): string`
183
+
184
+ Returns the path to the flag SVG file for use in your bundler.
185
+
186
+ ```typescript
187
+ import { getFlagPath } from "national-metadata";
188
+
189
+ getFlagPath("US"); // "national-metadata/dist/flag-svg/US.svg"
190
+ getFlagPath("fr"); // "national-metadata/dist/flag-svg/FR.svg" (case-insensitive)
191
+ ```
192
+
193
+ #### `getFlagFilename(countryCode: string): string`
194
+
195
+ Returns just the filename of the flag.
196
+
197
+ ```typescript
198
+ import { getFlagFilename } from "national-metadata";
199
+
200
+ getFlagFilename("US"); // "US.svg"
201
+ ```
202
+
203
+ #### `hasFlagForCountry(countryCode: string): boolean`
204
+
205
+ Check if a flag exists for a given country code.
206
+
207
+ ```typescript
208
+ import { hasFlagForCountry } from "national-metadata";
209
+
210
+ hasFlagForCountry("US"); // true
211
+ hasFlagForCountry("XX"); // false
212
+ ```
213
+
214
+ ### Flag Data Exports
215
+
216
+ #### `flagFilenames`
217
+
218
+ Object mapping country codes to flag filenames.
219
+
220
+ ```typescript
221
+ import { flagFilenames } from "national-metadata";
222
+
223
+ flagFilenames["US"]; // "US.svg"
224
+ Object.keys(flagFilenames).length; // 260+ flags available
225
+ ```
226
+
227
+ #### `availableFlagCodes`
228
+
229
+ Array of all country codes that have flags.
230
+
231
+ ```typescript
232
+ import { availableFlagCodes } from "national-metadata";
233
+
234
+ availableFlagCodes; // ["AC", "AD", "AE", "AF", ...]
157
235
  ```
158
236
 
237
+ ### Using Flags in React/Next.js
238
+
239
+ For React and Next.js applications, you can import flag SVGs directly:
240
+
241
+ #### Option 1: Direct Import (Recommended for Modern Bundlers)
242
+
243
+ ```typescript
244
+ import { country_to_code } from "national-metadata";
245
+
246
+ // In your component
247
+ <img
248
+ src={
249
+ new URL(
250
+ `../node_modules/national-metadata/dist/flag-svg/${
251
+ country_to_code[city.country]
252
+ }.svg`,
253
+ import.meta.url
254
+ ).href
255
+ }
256
+ alt={`${city.country} flag`}
257
+ className="w-12 h-12"
258
+ />;
259
+ ```
260
+
261
+ #### Option 2: Next.js Public Folder (Copy to Public)
262
+
263
+ ```bash
264
+ # Copy flags to your public folder
265
+ cp -r node_modules/national-metadata/dist/flag-svg public/flags
266
+ ```
267
+
268
+ Then use in your component:
269
+
270
+ ```typescript
271
+ import { country_to_code } from "national-metadata";
272
+
273
+ <img
274
+ src={`/flags/${country_to_code[city.country]}.svg`}
275
+ alt={`${city.country} flag`}
276
+ className="w-12 h-12"
277
+ />;
278
+ ```
279
+
280
+ #### Option 3: Webpack/Vite with Explicit Imports
281
+
282
+ For Vite or modern bundlers:
283
+
284
+ ```typescript
285
+ // Create a flag component
286
+ import { getFlagFilename } from "national-metadata";
287
+
288
+ interface FlagProps {
289
+ countryCode: string;
290
+ className?: string;
291
+ alt?: string;
292
+ }
293
+
294
+ export function Flag({ countryCode, className, alt }: FlagProps) {
295
+ // Dynamic import for tree-shaking
296
+ const flagSrc = `/node_modules/national-metadata/dist/flag-svg/${countryCode.toUpperCase()}.svg`;
297
+
298
+ return (
299
+ <img
300
+ src={flagSrc}
301
+ alt={alt || `${countryCode} flag`}
302
+ className={className}
303
+ />
304
+ );
305
+ }
306
+ ```
307
+
308
+ ### Tree-Shaking Support
309
+
310
+ This package is fully optimized for tree-shaking. Only the functions and data you import will be included in your bundle:
311
+
312
+ ```typescript
313
+ // This only bundles the flag utilities, not all country data
314
+ import { getFlagPath, hasFlagForCountry } from "national-metadata";
315
+ ```
316
+
317
+ The package uses:
318
+
319
+ - `"sideEffects": false` for aggressive tree-shaking
320
+ - ES Modules for optimal bundler support
321
+ - Separate flag utilities to minimize bundle size
322
+
159
323
  ## TypeScript Support
160
324
 
161
325
  Full TypeScript support with exported types:
162
326
 
163
327
  ```typescript
164
- import type {
328
+ import type {
165
329
  Country,
166
330
  CountryMapping,
167
331
  MercatorCoordinate,
168
332
  CountryCode,
169
333
  CountryName,
170
334
  ThreeDigitCode,
171
- TwoDigitCode
172
- } from 'jiang-hu';
335
+ TwoDigitCode,
336
+ FlagCountryCode,
337
+ } from "national-metadata";
173
338
 
174
339
  // Country interface
175
340
  interface Country {
@@ -181,6 +346,7 @@ interface Country {
181
346
  // Type-safe country codes
182
347
  type CountryCode = keyof typeof code_to_country;
183
348
  type CountryName = keyof typeof country_to_code;
349
+ type FlagCountryCode = keyof typeof flagFilenames; // All valid flag codes
184
350
  ```
185
351
 
186
352
  ## Use Cases
@@ -196,13 +362,13 @@ type CountryName = keyof typeof country_to_code;
196
362
  ### Building a Country Selector
197
363
 
198
364
  ```typescript
199
- import { list_of_countries, getCountryCodeFromName } from 'jiang-hu';
365
+ import { list_of_countries, getCountryCodeFromName } from "national-metadata";
200
366
 
201
367
  // Create dropdown options
202
- const countryOptions = list_of_countries.map(country => ({
368
+ const countryOptions = list_of_countries.map((country) => ({
203
369
  value: country.iso_two,
204
370
  label: country.name,
205
- continent: country.continent
371
+ continent: country.continent,
206
372
  }));
207
373
 
208
374
  // Group by continent
@@ -217,7 +383,7 @@ const continentGroups = countryOptions.reduce((groups, country) => {
217
383
  ### Map Visualization
218
384
 
219
385
  ```typescript
220
- import { mercator_hash, countrySizeScales } from 'jiang-hu';
386
+ import { mercator_hash, countrySizeScales } from "national-metadata";
221
387
 
222
388
  // Plot countries on a map
223
389
  Object.entries(mercator_hash).forEach(([code, [lng, lat]]) => {
@@ -229,7 +395,7 @@ Object.entries(mercator_hash).forEach(([code, [lng, lat]]) => {
229
395
  ### Data Validation
230
396
 
231
397
  ```typescript
232
- import { convertTwoToThree, getCountryNameFromCode } from 'jiang-hu';
398
+ import { convertTwoToThree, getCountryNameFromCode } from "national-metadata";
233
399
 
234
400
  function validateCountryCode(code: string): boolean {
235
401
  return getCountryNameFromCode(code) !== undefined;
@@ -243,6 +409,262 @@ function normalizeCountryCode(code: string): string | null {
243
409
  }
244
410
  ```
245
411
 
412
+ ## 🏙️ City Data
413
+
414
+ National Metadata includes comprehensive city slug data for easy integration with city-based applications.
415
+
416
+ ### City Functions
417
+
418
+ #### `getCitySlugs(): string[]`
419
+
420
+ Returns array of all city slugs (1300+ cities).
421
+
422
+ ```typescript
423
+ import { getCitySlugs } from "national-metadata";
424
+
425
+ const cities = getCitySlugs();
426
+ // ["lisbon", "berlin", "tokyo", "new-york-city-ny", ...]
427
+ ```
428
+
429
+ #### `getCityCountrySlugs(): string[]`
430
+
431
+ Returns array of city slugs with country information (format: `city-country`).
432
+
433
+ ```typescript
434
+ import { getCityCountrySlugs } from "national-metadata";
435
+
436
+ const citiesWithCountries = getCityCountrySlugs();
437
+ // ["lisbon-portugal", "berlin-germany", "tokyo-japan", ...]
438
+ ```
439
+
440
+ #### `isCitySlugValid(slug: string): boolean`
441
+
442
+ Validates if a city slug exists in the database.
443
+
444
+ ```typescript
445
+ import { isCitySlugValid } from "national-metadata";
446
+
447
+ isCitySlugValid("tokyo"); // true
448
+ isCitySlugValid("fake-city"); // false
449
+ ```
450
+
451
+ #### `isCityCountrySlugValid(slug: string): boolean`
452
+
453
+ Validates if a city-country slug exists.
454
+
455
+ ```typescript
456
+ import { isCityCountrySlugValid } from "national-metadata";
457
+
458
+ isCityCountrySlugValid("tokyo-japan"); // true
459
+ isCityCountrySlugValid("tokyo-china"); // false
460
+ ```
461
+
462
+ ### City Data Exports
463
+
464
+ ```typescript
465
+ import { city_slugs, city_country_slugs } from "national-metadata";
466
+
467
+ // Array of 1300+ city slugs
468
+ city_slugs; // ["lisbon", "berlin", "tokyo", ...]
469
+
470
+ // Array of 1300+ city-country slugs
471
+ city_country_slugs; // ["lisbon-portugal", "berlin-germany", ...]
472
+ ```
473
+
474
+ ## ✈️ Immigration & Visa Data
475
+
476
+ Comprehensive visa requirements data for all countries (updated Q3 2024).
477
+
478
+ ### Visa Functions
479
+
480
+ #### `getVisaRequirements(countryCode: string): VisaTravel | undefined`
481
+
482
+ Gets all visa information for a country.
483
+
484
+ ```typescript
485
+ import { getVisaRequirements } from "national-metadata";
486
+
487
+ const usVisa = getVisaRequirements("US");
488
+ // {
489
+ // country_code: "US",
490
+ // visa_free: ["Canada", "Mexico", ...],
491
+ // visa_on_arrival: [...],
492
+ // e_visa: [...],
493
+ // visa_required: [...]
494
+ // }
495
+ ```
496
+
497
+ #### `getVisaFreeCountries(countryCode: string): string[] | undefined`
498
+
499
+ Gets list of countries that don't require visa.
500
+
501
+ ```typescript
502
+ import { getVisaFreeCountries } from "national-metadata";
503
+
504
+ const visaFree = getVisaFreeCountries("US");
505
+ // ["Canada", "Mexico", "United Kingdom", ...]
506
+ ```
507
+
508
+ #### `getVisaOnArrivalCountries(countryCode: string): string[] | undefined`
509
+
510
+ Gets list of countries offering visa on arrival.
511
+
512
+ ```typescript
513
+ import { getVisaOnArrivalCountries } from "national-metadata";
514
+
515
+ const visaOnArrival = getVisaOnArrivalCountries("US");
516
+ ```
517
+
518
+ #### `getEVisaCountries(countryCode: string): string[] | undefined`
519
+
520
+ Gets list of countries offering e-visa.
521
+
522
+ ```typescript
523
+ import { getEVisaCountries } from "national-metadata";
524
+
525
+ const eVisa = getEVisaCountries("US");
526
+ ```
527
+
528
+ #### `getVisaRequiredCountries(countryCode: string): string[] | undefined`
529
+
530
+ Gets list of countries requiring visa.
531
+
532
+ ```typescript
533
+ import { getVisaRequiredCountries } from "national-metadata";
534
+
535
+ const visaRequired = getVisaRequiredCountries("US");
536
+ ```
537
+
538
+ ### Visa Data Exports
539
+
540
+ ```typescript
541
+ import { visa_travel, type VisaTravel } from "national-metadata";
542
+
543
+ // Record mapping country codes to visa requirements
544
+ visa_travel["US"]; // Full visa data for United States
545
+
546
+ // TypeScript interface
547
+ interface VisaTravel {
548
+ country_code: string;
549
+ e_visa?: string[];
550
+ visa_on_arrival?: string[];
551
+ visa_required?: string[];
552
+ visa_free?: string[];
553
+ }
554
+ ```
555
+
556
+ ## 📊 Legatum Prosperity Index 2023
557
+
558
+ Access comprehensive prosperity rankings data from the Legatum Institute's 2023 Prosperity Index.
559
+
560
+ ### Legatum Functions
561
+
562
+ #### `getLegatumData(): Legatum2023[]`
563
+
564
+ Returns complete Legatum prosperity rankings.
565
+
566
+ ```typescript
567
+ import { getLegatumData } from "national-metadata";
568
+
569
+ const allRankings = getLegatumData();
570
+ // Array of 167 countries with 12 prosperity pillars
571
+ ```
572
+
573
+ #### `getLegatumRankingByCountry(countryName: string): Legatum2023 | undefined`
574
+
575
+ Gets prosperity ranking for a specific country.
576
+
577
+ ```typescript
578
+ import { getLegatumRankingByCountry } from "national-metadata";
579
+
580
+ const denmark = getLegatumRankingByCountry("Denmark");
581
+ // {
582
+ // country: "Denmark",
583
+ // overall: 1,
584
+ // safety_and_security: 6,
585
+ // personal_freedom: 2,
586
+ // governance: 3,
587
+ // social_capital: 1,
588
+ // investment_environment: 8,
589
+ // enterprise_conditions: 8,
590
+ // infrastructure_and_market_access: 9,
591
+ // economic_quality: 7,
592
+ // living_conditions: 2,
593
+ // health: 16,
594
+ // education: 5,
595
+ // natural_environment: 5
596
+ // }
597
+ ```
598
+
599
+ #### `getLegatumTopCountries(limit?: number): Legatum2023[]`
600
+
601
+ Gets top N countries by prosperity ranking (default 10).
602
+
603
+ ```typescript
604
+ import { getLegatumTopCountries } from "national-metadata";
605
+
606
+ const top10 = getLegatumTopCountries();
607
+ const top5 = getLegatumTopCountries(5);
608
+ // Returns top ranked countries
609
+ ```
610
+
611
+ #### `getLegatumCountriesByOverallRank(minRank: number, maxRank: number): Legatum2023[]`
612
+
613
+ Gets countries within a rank range.
614
+
615
+ ```typescript
616
+ import { getLegatumCountriesByOverallRank } from "national-metadata";
617
+
618
+ const topTier = getLegatumCountriesByOverallRank(1, 20);
619
+ // Returns countries ranked 1-20
620
+ ```
621
+
622
+ ### Legatum Data Exports
623
+
624
+ ```typescript
625
+ import { legatum_2023, type Legatum2023 } from "national-metadata";
626
+
627
+ // Array of all country rankings
628
+ legatum_2023; // 167 countries
629
+
630
+ // TypeScript interface
631
+ interface Legatum2023 {
632
+ country: string;
633
+ overall: number;
634
+ safety_and_security: number;
635
+ personal_freedom: number;
636
+ governance: number;
637
+ social_capital: number;
638
+ investment_environment: number;
639
+ enterprise_conditions: number;
640
+ infrastructure_and_market_access: number;
641
+ economic_quality: number;
642
+ living_conditions: number;
643
+ health: number;
644
+ education: number;
645
+ natural_environment: number;
646
+ }
647
+ ```
648
+
649
+ ### Legatum Index Pillars
650
+
651
+ The Legatum Prosperity Index measures prosperity across 12 pillars:
652
+
653
+ 1. **Safety & Security**: Personal and national security
654
+ 2. **Personal Freedom**: Individual liberties and rights
655
+ 3. **Governance**: Effective and accountable governance
656
+ 4. **Social Capital**: Social cohesion and engagement
657
+ 5. **Investment Environment**: Protection of investors and financial infrastructure
658
+ 6. **Enterprise Conditions**: Business environment and competition
659
+ 7. **Infrastructure & Market Access**: Physical and digital infrastructure
660
+ 8. **Economic Quality**: Economic growth and opportunity
661
+ 9. **Living Conditions**: Material wellbeing and housing
662
+ 10. **Health**: Physical and mental health outcomes
663
+ 11. **Education**: Access to quality education
664
+ 12. **Natural Environment**: Environmental quality and protection
665
+
666
+ Lower numbers indicate better rankings (1 = best).
667
+
246
668
  ## Contributing
247
669
 
248
670
  We welcome contributions! Please see our contributing guidelines for more details.
@@ -253,7 +675,29 @@ MIT License - see LICENSE file for details.
253
675
 
254
676
  ## Changelog
255
677
 
256
- ### v1.0.0
678
+ ### v0.3.0 (Upcoming)
679
+
680
+ - **NEW**: City data exports - 1300+ city slugs and city-country slugs
681
+ - **NEW**: City utility functions: `getCitySlugs`, `getCityCountrySlugs`, `isCitySlugValid`, `isCityCountrySlugValid`
682
+ - **NEW**: Immigration & Visa data - Comprehensive visa requirements for all countries (Q3 2024)
683
+ - **NEW**: Visa utility functions: `getVisaRequirements`, `getVisaFreeCountries`, `getVisaOnArrivalCountries`, `getEVisaCountries`, `getVisaRequiredCountries`
684
+ - **NEW**: Legatum Prosperity Index 2023 - Rankings for 167 countries across 12 prosperity pillars
685
+ - **NEW**: Legatum utility functions: `getLegatumData`, `getLegatumRankingByCountry`, `getLegatumTopCountries`, `getLegatumCountriesByOverallRank`
686
+ - **NEW**: TypeScript types: `VisaTravel`, `Legatum2023`
687
+ - **IMPROVED**: Expanded package capabilities for travel, immigration, and prosperity research
688
+
689
+ ### v0.2.0
690
+
691
+ - **NEW**: Flag SVGs for 260+ countries included in package
692
+ - **NEW**: Flag utility functions: `getFlagPath`, `getFlagFilename`, `hasFlagForCountry`
693
+ - **NEW**: Flag data exports: `flagFilenames`, `availableFlagCodes`
694
+ - **NEW**: Full tree-shaking support with `sideEffects: false`
695
+ - **NEW**: ES Modules support for better bundler optimization
696
+ - **IMPROVED**: TypeScript types with new `FlagCountryCode` type
697
+ - **IMPROVED**: Package exports map for better module resolution
698
+
699
+ ### v0.1.1
700
+
257
701
  - Initial release with comprehensive country data
258
702
  - ISO code conversion utilities
259
703
  - Mercator coordinates for map visualization
@@ -0,0 +1,2 @@
1
+ export declare const city_country_slugs: string[];
2
+ //# sourceMappingURL=city-country-slugs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"city-country-slugs.d.ts","sourceRoot":"","sources":["../../src/cities/city-country-slugs.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,EAAE,MAAM,EAg0CtC,CAAC"}