@innovayse/geo-atlas 2.0.1 → 2.1.0
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 +31 -1
- package/dist/cjs/data/atlas.json +1 -1
- package/dist/cjs/helpers/CountriesAtlas.d.ts +5 -1
- package/dist/cjs/helpers/CountriesAtlas.js +15 -30
- package/dist/cjs/helpers/countryLoaders.d.ts +17 -0
- package/dist/cjs/helpers/countryLoaders.js +287 -0
- package/dist/cjs/index.d.ts +8 -0
- package/dist/cjs/types/country.interface.d.ts +2 -0
- package/dist/cjs/types/phone-code.interface.d.ts +2 -0
- package/dist/esm/data/atlas.json +1 -1
- package/dist/esm/helpers/CountriesAtlas.d.ts +5 -1
- package/dist/esm/helpers/CountriesAtlas.js +14 -5
- package/dist/esm/helpers/countryLoaders.d.ts +17 -0
- package/dist/esm/helpers/countryLoaders.js +262 -0
- package/dist/esm/index.d.ts +8 -0
- package/dist/esm/types/country.interface.d.ts +2 -0
- package/dist/esm/types/phone-code.interface.d.ts +2 -0
- package/package.json +47 -1
package/README.md
CHANGED
|
@@ -9,11 +9,12 @@ Zero API calls — all data is bundled locally.
|
|
|
9
9
|
|
|
10
10
|
## Features
|
|
11
11
|
|
|
12
|
-
- **250 countries** with ISO2/ISO3 codes, flags, phone codes, capitals, coordinates
|
|
12
|
+
- **250 countries** with ISO2/ISO3 codes, flags, phone codes, phone format placeholders, capitals, coordinates
|
|
13
13
|
- **147,000+ cities** across all countries with coordinates
|
|
14
14
|
- **Complete multilingual city names**: English, Russian (ru), Armenian (hy) + 15 more languages
|
|
15
15
|
- **Country translations**: all 250 countries translated to Russian and Armenian
|
|
16
16
|
- **Native script** support for each city and country
|
|
17
|
+
- **Phone format placeholders** for all 250 countries (e.g. `+374 9X XXX XXX` for Armenia)
|
|
17
18
|
- **Dual ESM + CJS build** — works in browsers, Node.js, Nuxt 3, Vite
|
|
18
19
|
- **TypeScript** — full type declarations included
|
|
19
20
|
- **Zero runtime dependencies** — fully offline, no API calls
|
|
@@ -93,6 +94,7 @@ type Country = {
|
|
|
93
94
|
emoji: string // '🇦🇲'
|
|
94
95
|
capital: string // 'Yerevan'
|
|
95
96
|
phone: number // 374
|
|
97
|
+
phone_format: string // '+374 9X XXX XXX'
|
|
96
98
|
latitude: string // '40.0'
|
|
97
99
|
longitude: string // '45.0'
|
|
98
100
|
translations: {
|
|
@@ -105,6 +107,34 @@ type Country = {
|
|
|
105
107
|
}
|
|
106
108
|
```
|
|
107
109
|
|
|
110
|
+
### Phone format placeholder
|
|
111
|
+
|
|
112
|
+
`phone_format` contains the full international format with `X` for variable digits:
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
const am = CountriesAtlas.callingCode('AM')
|
|
116
|
+
// {
|
|
117
|
+
// name: 'Armenia',
|
|
118
|
+
// phone: 374,
|
|
119
|
+
// iso2: 'AM',
|
|
120
|
+
// phone_code: '+374',
|
|
121
|
+
// phone_format: '+374 9X XXX XXX',
|
|
122
|
+
// flag: 'flag flag-am'
|
|
123
|
+
// }
|
|
124
|
+
|
|
125
|
+
// Use as input placeholder:
|
|
126
|
+
// <input :placeholder="callingCode.phone_format" />
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
| Country | `phone_format` |
|
|
130
|
+
|---------|---------------|
|
|
131
|
+
| Armenia (AM) | `+374 9X XXX XXX` |
|
|
132
|
+
| Russia (RU) | `+7 9XX XXX XXXX` |
|
|
133
|
+
| USA (US) | `+1 XXX XXX XXXX` |
|
|
134
|
+
| Germany (DE) | `+49 XXXX XXXXXXX` |
|
|
135
|
+
| France (FR) | `+33 X XX XX XX XX` |
|
|
136
|
+
| UK (GB) | `+44 XXXX XXXXXX` |
|
|
137
|
+
|
|
108
138
|
## Nuxt 3 / Vite Setup
|
|
109
139
|
|
|
110
140
|
To prevent esbuild from processing the large JSON data files (which causes OOM crashes), exclude the package from Vite's dependency optimization:
|