countrynormalizer 0.2.6 → 0.2.8

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.
@@ -0,0 +1,25 @@
1
+ import type { AllCountryFields } from "../types/core";
2
+ /**
3
+ * Searches all country data fields — including non-unique fields — and returns every
4
+ * country that matches the given needle.
5
+ *
6
+ * Unlike {@link findCountryByUnique}, this also searches across:
7
+ * - `calling_code` — phone calling codes (e.g. `"+1"`, `"44"`)
8
+ * - `continent` — continent name (e.g. `"Asia"`)
9
+ * - `demonym_male` / `demonym_female` — demonyms (e.g. `"Canadian"`)
10
+ * - `tld` — top-level domain (e.g. `".uk"`)
11
+ *
12
+ * All unique fields (`alpha_2`, `alpha_3`, `english_clean`, `formal_order`,
13
+ * `common_reference`, `flag_emoji`, `num_code`) are searched as well.
14
+ *
15
+ * @param needle - The search value: a country name, ISO code, numeric code, calling code,
16
+ * continent name, demonym, TLD, or flag emoji.
17
+ * @returns An array of all matching countries. Returns an empty array if no matches are found.
18
+ *
19
+ * @example
20
+ * findAllMatchedCountries("+1"); // All countries sharing calling code "1"
21
+ * findAllMatchedCountries("asia"); // All countries in Asia
22
+ * findAllMatchedCountries("GB"); // Single-item array with United Kingdom data
23
+ * findAllMatchedCountries("zzzzz"); // []
24
+ */
25
+ export declare const findAllMatchedCountries: (needle: string | number) => AllCountryFields[];
@@ -27,27 +27,3 @@ import type { AllCountryFields } from "../types/core";
27
27
  * findCountryByUnique("xx"); // Returns null
28
28
  */
29
29
  export declare const findCountryByUnique: (needle: string | number) => AllCountryFields | null;
30
- /**
31
- * Searches all country data fields — including non-unique fields — and returns every
32
- * country that matches the given needle.
33
- *
34
- * Unlike {@link findCountryByUnique}, this also searches across:
35
- * - `calling_code` — phone calling codes (e.g. `"+1"`, `"44"`)
36
- * - `continent` — continent name (e.g. `"Asia"`)
37
- * - `demonym_male` / `demonym_female` — demonyms (e.g. `"Canadian"`)
38
- * - `tld` — top-level domain (e.g. `".uk"`)
39
- *
40
- * All unique fields (`alpha_2`, `alpha_3`, `english_clean`, `formal_order`,
41
- * `common_reference`, `flag_emoji`, `num_code`) are searched as well.
42
- *
43
- * @param needle - The search value: a country name, ISO code, numeric code, calling code,
44
- * continent name, demonym, TLD, or flag emoji.
45
- * @returns An array of all matching countries. Returns an empty array if no matches are found.
46
- *
47
- * @example
48
- * findAllMatchedCountries("+1"); // All countries sharing calling code "1"
49
- * findAllMatchedCountries("asia"); // All countries in Asia
50
- * findAllMatchedCountries("GB"); // Single-item array with United Kingdom data
51
- * findAllMatchedCountries("zzzzz"); // []
52
- */
53
- export declare const findAllMatchedCountries: (needle: string | number) => AllCountryFields[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "countrynormalizer",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "ISO 3166 country data lookup and normalization. Convert between alpha-2, alpha-3, ISO numbers, country names, calling codes, flag emojis, TLDs, continents, and demonyms.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -60,7 +60,10 @@
60
60
  "scripts": {
61
61
  "build": "bun run build.ts",
62
62
  "test": "bun test",
63
- "extract-data": "bun ./tools/build-data.ts"
63
+ "extract-data": "bun ./tools/build-data.ts",
64
+ "format": "prettier --write .",
65
+ "format:check": "prettier --check .",
66
+ "typecheck": "tsc --noemit"
64
67
  },
65
68
  "devDependencies": {
66
69
  "@types/bun": "latest",
@@ -68,7 +71,8 @@
68
71
  "@types/lodash": "^4.17.24",
69
72
  "csvtojson": "^2.0.14",
70
73
  "jest": "^30.2.0",
71
- "lodash": "^4.17.23"
74
+ "lodash": "^4.17.23",
75
+ "prettier": "^3.8.1"
72
76
  },
73
77
  "peerDependencies": {
74
78
  "typescript": "^5"