Releases: Clifftech123/CountryData.js
Releases · Clifftech123/CountryData.js
Release list
v2.0.0
Major Changes
-
22cd3be: Add states/provinces (4963), cities (148k+), timezones, and regions support. New functional module API — Country, State, City, Region, Timezone — with O(1) Map-based lookups. Enriched country data with currency code, coordinates, timezones, and flag emoji. Lazy loading for city data, pre-sorted JSON files, and full TypeScript types for all interfaces.
Breaking Changes
What changed
IRegionfields renamed fromName/ShortCodetoname/shortCode(lowercase)- Data files moved from
src/*.jsontodata/*.json
Why
Standardised all interfaces to use consistent lowercase field names matching the rest of the data model.
How to update
Before (v1.x):
import { CountryHelper } from 'countrydata.js'; const helper = new CountryHelper(); const regions = helper.getRegionsByCountryShortCode('US'); regions[0].Name; // old regions[0].ShortCode; // old
After (v2.x):
import { CountryHelper, Country, State, City, Region, Timezone, } from 'countrydata.js'; // Class API (still works) const helper = new CountryHelper(); const regions = helper.getRegionsByCountryShortCode('US'); regions[0].name; // updated regions[0].shortCode; // updated // New module API const us = Country.getCountryByCode('US'); const states = State.getStatesOfCountry('US'); const cities = City.getCitiesOfState('US', 'CA'); const tzs = Timezone.getTimezonesByCountryCode('US');
v1.1.0
Minor Changes
- 1f397b6: Enhanced the flag emoji functionality by renaming the method from getCountryEmoji to getCountryFlag, implementing proper string manipulation techniques, and optimizing performance.
v1.0.6
Patch Changes
- 47916f4: Fix: Resolved the GitHub repository connection problem with npm and added a sample index.js.
v1.0.5
Patch Changes
- 227b2df: Fix: Fixed TypeScript types for Country and Region. Fixed the TypeScript compilation error.
- 3683b6d: Stable release for general use. Fixed all TypeScript issues and ensured compatibility with both JavaScript and TypeScript environments. Updated README to align with npm standards.
- 83710eb: Updated build configuration to exclusively use ES Modules (ESM). Fixed the error our data.json not found. Updated the package.json to include the
typefield set tomodule. - 10f9d39: Fix: Fixed TypeScript types for Country and Region. Fixed the TypeScript compilation error.
v1.0.4
Patch Changes
- 10f9d39: Fix: Fixed TypeScript types for Country and Region. Fixed the TypeScript compilation error.
v1.0.3
Patch Changes
- 83710eb: Updated build configuration to exclusively use ES Modules (ESM). Fixed the error our data.json not found. Updated the package.json to include the
typefield set tomodule.
v1.0.2
Patch Changes
- def97ba: Updated the GitHub Actions workflow to use Vitest for running tests and collecting coverage. Installed the
@vitest/coverage-v8dependency to ensure coverage reports are generated correctly. Updated thevitest.config.tsto specify thev8coverage provider.
v1.0.1
Patch Changes
- 19a4fd5: Fix JavaScript and TypeScript compatibility issues
v1.0.0
Major Changes
- 071426c: Initial release of CountryData.js. This package provides comprehensive country data for Node.js developers, allowing easy integration with any Node.js framework. It includes features such as retrieving country information by code and listing all countries.