Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deftomat/just-cldr-datasets
CLDR datasets exported as JavaScript objects.
https://github.com/deftomat/just-cldr-datasets
cldr country dataset provice state timezone
Last synced: 19 days ago
JSON representation
CLDR datasets exported as JavaScript objects.
- Host: GitHub
- URL: https://github.com/deftomat/just-cldr-datasets
- Owner: deftomat
- License: mit
- Created: 2018-09-22T17:07:55.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-05-09T17:56:16.000Z (over 3 years ago)
- Last Synced: 2024-11-27T19:53:31.188Z (about 1 month ago)
- Topics: cldr, country, dataset, provice, state, timezone
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/just-cldr-datasets
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Just CLDR datasets
A simple package with CLDR datasets exported as JavaScript objects.
## Why ?
Because you want to include a simple list of time zones, countries, etc. in your application without importing any other unnecessary code.
## Available datasets (English only)
- Time zones
- Countries
- States / Provinces (US, CA, AU)## Installation
```
npm install just-cldr-datasets --save
```## Usage
```js
import timeZones from 'just-cldr-datasets/timeZones';
import countries from 'just-cldr-datasets/countries';
import states from 'just-cldr-datasets/states';console.log(timeZones); // ['Africa/Abidjan', 'Africa/Accra', ...]
console.log(countries.CA); // Canada
console.log(states.CA.ON); // Ontario
```## TypeScript support
All datasets includes TypeScript type definitions.
For example, type checker will complain about `states.US.AB` as state `AB` doesn't exist in `US` country.
## Contribution
1. Add a generator function to [bin/generate.js](./bin/generate.js) or manually create a predefined dataset in `predefined` directory.
2. Run `npm run build`.
3. Double check the generated JS files.
4. Create a PR 🎉