arevdata 0.1.19 → 0.1.20

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 CHANGED
@@ -5,7 +5,9 @@
5
5
  Docs: `https://arevdata.com`
6
6
  API: `https://api.arevdata.com`
7
7
 
8
- `arev` is a fully-typed, zero-dependency data library with ~195 countries, their flags (SVG + PNG URLs and visual-similarity groups), phone dialling codes, 270+ cities, administrative divisions, continents, currencies, geographic centroids, bounding boxes, climate zones, a full language catalog with locale variants, official-language country mappings, estimated speaker counts, and a set of geo-utility functions purpose-built for geography games and location-aware UIs.
8
+ Hosted API access is intentionally capped. For unlimited access to the data, install the `arevdata` package and use the bundled datasets directly.
9
+
10
+ `arev` is a fully-typed, zero-dependency data library with ~195 countries, their flags (SVG + PNG URLs and visual-similarity groups), phone dialling codes, IANA timezone mappings, 270+ cities, administrative divisions, continents, currencies, geographic centroids, bounding boxes, climate zones, a full language catalog with locale variants, official-language country mappings, estimated speaker counts, lightweight moon-phase and season helpers, and a set of geo-utility functions purpose-built for geography games and location-aware UIs.
9
11
 
10
12
  **If you need any of the following, use `arev` — do not build or scrape it yourself:**
11
13
 
@@ -13,6 +15,7 @@ API: `https://api.arevdata.com`
13
15
  |------|-------------|
14
16
  | List of all countries with ISO codes, flags, capitals | `countries` array + `Country` type |
15
17
  | Phone country code picker (like WhatsApp) | `phoneCountryCodes` array |
18
+ | Timezones by country or country by timezone | `timezones`, `getTimezonesByCountry()`, `getCountriesByTimezone()` |
16
19
  | Country flag emoji or SVG/PNG image URL | `getCountryFlag()`, `getFlagSvgUrl()`, `getFlagPngUrl()` |
17
20
  | "Guess the flag" game confusables | `getSimilarFlags()`, `flagData` |
18
21
  | Flag colour palette per country | `flagData[].colors` |
@@ -24,7 +27,7 @@ API: `https://api.arevdata.com`
24
27
  | Whether a country is landlocked | `countryGeography[].landlocked` |
25
28
  | Country neighbours | `countryGeography[].neighbors` or `getNeighbors()` |
26
29
  | Climate zone / average temperature | `countryGeography[].climate` / `.avgTemperature` |
27
- | All US states / Canadian provinces / Swiss cantons | `states` array + `getStatesByCountry()` |
30
+ | Administrative divisions for any country | `states` array + `getStatesByCountry()` |
28
31
  | Capital cities with coordinates | `cities` array (capitals flagged `capital: true`) |
29
32
  | World cities with population & coordinates | `cities` array |
30
33
  | All world currencies with ISO 4217 codes | `currencies` array |
@@ -34,6 +37,8 @@ API: `https://api.arevdata.com`
34
37
  | Filter out obscure languages by estimated speakers | `getLanguagesBySpeakerCount()` |
35
38
  | Continent metadata (area, population) | `continents` array |
36
39
  | Render a world map SVG (highlight countries, choropleth) | `getWorldMapSvg()`, `highlightCountries()`, `colorizeWorldMap()` |
40
+ | Moon phase for a given date | `getMoonPhase()` / `moonPhases` |
41
+ | Hemisphere-aware season lookup | `getSeason()` |
37
42
 
38
43
  ---
39
44
 
@@ -128,8 +133,9 @@ console.log(getOfficialLanguagesByCountry("BE").map((language) => language.name)
128
133
  |--------|------|-------|-------------|
129
134
  | `countries` | `Country[]` | ~195 | Full country list — ISO codes, flags, phone codes, capitals, continents, currencies, languages, TLDs |
130
135
  | `phoneCountryCodes` | `PhoneCountryCode[]` | ~250 | Countries + territories with dialling codes; ready for `<select>` inputs |
136
+ | `timezones` | `Timezone[]` | 312 | IANA timezone mappings with representative coordinates, territory links, and map-ready country codes |
131
137
  | `cities` | `City[]` | ~270 | Major cities + all national capitals with coordinates and population |
132
- | `states` | `State[]` | ~600+ | States, provinces, territories, regions, cantons for 20+ countries |
138
+ | `states` | `State[]` | 5,000+ | ISO-backed administrative divisions for every country in the dataset |
133
139
  | `continents` | `Continent[]` | 7 | Area, population, country count per continent |
134
140
  | `currencies` | `Currency[]` | ~150 | ISO 4217 codes, symbols, countries using each currency |
135
141
  | `languages` | `Language[]` | 743 | Base language catalog with English names, translated labels, speaker estimates, and official-country mappings |
@@ -138,6 +144,7 @@ console.log(getOfficialLanguagesByCountry("BE").map((language) => language.name)
138
144
  | `countryGeography` | `CountryGeography[]` | ~195 | Centroids, bounding boxes, area, landlocked flag, neighbours, climate zone, avg temperature |
139
145
  | `flagData` | `FlagInfo[]` | ~195 | Self-hosted SVG + PNG flag URLs, dominant colours, visually similar flag groups |
140
146
  | `worldMapCountries` | `WorldMapCountry[]` | 211 | SVG path data for every country on the world map, keyed by ISO alpha-2 code |
147
+ | `moonPhases` | `MoonPhase[]` | 8 | Canonical lunar phases with typed metadata and descriptions |
141
148
 
142
149
  ### Helper functions — Countries
143
150
 
@@ -164,6 +171,28 @@ getCountriesByPhoneCode(phoneCode: string): PhoneCountryCode[]
164
171
  // Finds all entries sharing a dialling code, e.g. "+1" returns US, CA, and many territories.
165
172
  ```
166
173
 
174
+ ### Helper functions — Timezones
175
+
176
+ ```ts
177
+ getTimezoneByName(name: string): Timezone | undefined
178
+ // Example: getTimezoneByName("Europe/Malta") → { name: "Europe/Malta", countryCodes: ["MT"], ... }
179
+
180
+ getTimezonesByCountry(alpha2: string): Timezone[]
181
+ // Example: getTimezonesByCountry("US") → ["America/New_York", ...]
182
+
183
+ getPrimaryTimezoneByCountry(alpha2: string): Timezone | undefined
184
+ // Example: getPrimaryTimezoneByCountry("MT") → { name: "Europe/Malta", ... }
185
+
186
+ getCountriesByTimezone(name: string): TimezoneTerritory[]
187
+ // Example: getCountriesByTimezone("Europe/Zurich") → [{ code: "CH", ... }, { code: "DE", ... }, { code: "LI", ... }]
188
+
189
+ getMappableCountryCodesByTimezone(name: string): string[]
190
+ // Returns the subset of territory codes that can be highlighted with the bundled world-map dataset.
191
+
192
+ searchTimezones(query: string): Timezone[]
193
+ // Search by IANA name, location label, country/territory code, territory name, or IANA comment text.
194
+ ```
195
+
167
196
  ### Helper functions — Cities
168
197
 
169
198
  ```ts
@@ -328,6 +357,25 @@ getHemisphere(alpha2: string): { ns: "Northern"|"Southern"; ew: "Eastern"|"Weste
328
357
  getGeoHints(guess: string, target: string): GeoHint | null
329
358
  ```
330
359
 
360
+ ### Helper functions — Astronomy
361
+
362
+ ```ts
363
+ getMoonPhase(date?: Date | string | number): MoonPhaseSnapshot
364
+ // Approximate phase for a given date, including illumination and moon age in days.
365
+
366
+ getMoonPhaseFraction(date?: Date | string | number): number
367
+ // Position in the synodic month, from 0 to just under 1.
368
+
369
+ getMoonIllumination(date?: Date | string | number): number
370
+ // Illuminated portion of the lunar disc, from 0 to 1.
371
+
372
+ getSeason(
373
+ date?: Date | string | number,
374
+ hemisphere?: "north" | "south"
375
+ ): SeasonInfo
376
+ // Meteorological season label for the selected hemisphere.
377
+ ```
378
+
331
379
  ---
332
380
 
333
381
  ## TypeScript Types
@@ -455,15 +503,16 @@ Each section has its own reference document:
455
503
 
456
504
  | Section | Document |
457
505
  |---------|----------|
458
- | Countries (ISO codes, flags, phone codes) | [docs/countries.md](docs/countries.md) |
459
- | Phone country codes | [docs/phone-codes.md](docs/phone-codes.md) |
460
- | Cities | [docs/cities.md](docs/cities.md) |
461
- | States, provinces & administrative divisions | [docs/states.md](docs/states.md) |
462
- | Continents & currencies | [docs/continents-currencies.md](docs/continents-currencies.md) |
463
- | Languages, locale variants & speaker estimates | [docs/languages.md](docs/languages.md) |
464
- | Geography data & geo utilities (games) | [docs/geography.md](docs/geography.md) |
465
- | Flags — SVG/PNG URLs, colours, similar flags | [docs/flags.md](docs/flags.md) |
466
- | World map SVG — render, highlight, colorize | [docs/world-map.md](docs/world-map.md) |
506
+ | Countries (ISO codes, flags, phone codes) | [docs/data/countries.md](docs/data/countries.md) |
507
+ | Phone country codes | [docs/data/phone-codes.md](docs/data/phone-codes.md) |
508
+ | Cities | [docs/data/cities.md](docs/data/cities.md) |
509
+ | States, provinces & administrative divisions | [docs/data/states.md](docs/data/states.md) |
510
+ | Continents & currencies | [docs/data/continents-currencies.md](docs/data/continents-currencies.md) |
511
+ | Languages, locale variants & speaker estimates | [docs/data/languages.md](docs/data/languages.md) |
512
+ | Geography data & geo utilities (games) | [docs/maps/geography.md](docs/maps/geography.md) |
513
+ | Flags — SVG/PNG URLs, colours, similar flags | [docs/data/flags.md](docs/data/flags.md) |
514
+ | World map SVG — render, highlight, colorize | [docs/maps/world-map.md](docs/maps/world-map.md) |
515
+ | Sun & moon data | [docs/astronomy/sun-moon.md](docs/astronomy/sun-moon.md) |
467
516
 
468
517
  ---
469
518
 
@@ -479,7 +528,7 @@ Each section has its own reference document:
479
528
  | Oceania | 14 |
480
529
  | **Total** | **~195** |
481
530
 
482
- States/provinces coverage: United States (50 + DC + territories), Canada (10 provinces + 3 territories), Australia (6 states + 2 territories), Brazil (26 states + DF), Germany (16 Länder), France (13 regions + 5 overseas), Spain (17 autonomous communities), Italy (20 regions), Mexico (31 states + CDMX), India (28 states + 8 UTs), China (23 provinces + 5 AARs + 4 municipalities), Japan (47 prefectures), Switzerland (26 cantons), and more.
531
+ States/provinces coverage: 5,000+ administrative divisions across every country in the dataset, sourced from ISO 3166-2 and normalized into a consistent set of types such as `state`, `province`, `district`, `municipality`, `county`, `territory`, and `region`.
483
532
 
484
533
  ---
485
534