https://github.com/cloudblue/country-flag-mapper
https://github.com/cloudblue/country-flag-mapper
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/cloudblue/country-flag-mapper
- Owner: cloudblue
- License: apache-2.0
- Created: 2022-04-01T08:28:26.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2025-02-24T10:19:57.000Z (over 1 year ago)
- Last Synced: 2025-10-05T17:21:40.120Z (8 months ago)
- Language: JavaScript
- Size: 26.4 KB
- Stars: 4
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Country flag mapper
This package provides country flags as SVG icons, in a square (1x1) aspect ratio, mapped to country and locale IDs.
The flags are sourced from the [flag-icons](https://github.com/lipis/flag-icons) library.
### Installation
```bash
npm install --save @cloudblueconnect/country-flag-mapper
```
### Usage
```js
import {
flags,
locales,
localeFlags,
} from '@cloudblueconnect/country-flag-mapper';
// Getting Portugal's flag
const PORTUGAL_FLAG = flags.PT;
// Getting the icon for the spanish locale
const SPANISH_LANGUAGE_ICON = localeFlags.es;
// Getting the icon for a different spanish locale
const ARGENTINIAN_SPANISH_ICON = localeFlags[locales.ARGENTINIAN_SPANISH];
```
## License
`@cloudblueconnect/country-flag-mapper` is licensed under the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).