country-code-kit 1.0.2 → 1.0.5
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.
- package/README.md +17 -16
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Zero-dependency TypeScript package with all **249 ISO 3166-1 countries** — alp
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm
|
|
8
|
+
npm i country-code-kit
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
@@ -56,19 +56,21 @@ const { getName } = require("country-kit");
|
|
|
56
56
|
|
|
57
57
|
## API
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
|
62
|
-
| `
|
|
63
|
-
| `
|
|
64
|
-
| `
|
|
65
|
-
| `
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
59
|
+
|
|
60
|
+
| Function | Returns |
|
|
61
|
+
| ---------------------------------- | ---------------------------------------------------------------------- |
|
|
62
|
+
| `countries` | `readonly Country[]` — all 249 entries |
|
|
63
|
+
| `getCountryByCode(code)` | `Country | undefined` (case-insensitive) |
|
|
64
|
+
| `getCountryByName(name)` | `Country | undefined` (case-insensitive) |
|
|
65
|
+
| `getCountryByFlag(flag)` | `Country | undefined` |
|
|
66
|
+
| `getFlag(code)` / `getName(code)` | `string | undefined` |
|
|
67
|
+
| `getDialCode(code)` | `string | null | undefined` — `null` for territories with no dial code |
|
|
68
|
+
| `getCountriesByDialCode(dialCode)` | `Country[]` — all countries sharing a dial code (e.g. `"+1"`) |
|
|
69
|
+
| `isValidCode(code)` | `boolean` |
|
|
70
|
+
| `searchCountries(query)` | `Country[]` ranked by match quality |
|
|
71
|
+
| `codeToFlag(code)` | `string` (throws on invalid input) |
|
|
72
|
+
| `flagToCode(flag)` | `string | undefined` |
|
|
73
|
+
|
|
72
74
|
|
|
73
75
|
```ts
|
|
74
76
|
interface Country {
|
|
@@ -79,7 +81,6 @@ interface Country {
|
|
|
79
81
|
}
|
|
80
82
|
```
|
|
81
83
|
|
|
82
|
-
|
|
83
84
|
## License
|
|
84
85
|
|
|
85
|
-
MIT
|
|
86
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "country-code-kit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "v1.0.5",
|
|
4
4
|
"description": "Zero-dependency list of all 249 ISO 3166-1 countries with code, name, and flag emoji. Lookup and search helpers included. Tree-shakeable, works in Node and browsers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"country",
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
"import": "./dist/esm/index.js",
|
|
24
24
|
"require": "./dist/cjs/index.js"
|
|
25
25
|
}
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/ShrikantaMazumder/country-code-kit.git"
|
|
26
30
|
},
|
|
27
31
|
"files": [
|
|
28
32
|
"dist"
|