Package Exports
- country-flags-svg-v2
- country-flags-svg-v2/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (country-flags-svg-v2) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
country-flags-svg-v2
This has been taken from country-flags-svg. The developer seems to be AFK... This projects aims to correct the issues that were brought up.
Install
$ npm install country-flags-svg-v2
or
$ yarn add country-flags-svg-v2
Usage
import { findFlagUrlByNationality } from "country-flags-svg-v2";
const flagUrl = findFlagUrlByNationality("Australian");
// => "http://upload.wikimedia.org/wikipedia/commons/8/88/Flag_of_Australia_%28converted%29.svg"
import { countries } from "country-flags-svg-v2";
const australia = countries[0];
console.log(australia);
/* => {
name: "Australia",
demonym: "Australian",
flag: "http://upload.wikimedia.org/wikipedia/commons/8/88/Flag_of_Australia_%28converted%29.svg",
iso2: "AU",
iso3: "AUS",
}
*/
API
countries
Returns all available information.
findFlagUrlByCountryName(countryName)
Returns SVG link of the official flag for a specified country (according to countryName) or empty string if is not exist
findFlagUrlByNationality(nationality)
Returns SVG link of the official flag for a specified country (according to nationality) or empty string if is not exist
findFlagUrlByIso2Code(iso2Code)
Returns SVG link of the official flag for a specified country (according to ISO 3166-1 alpha-2 code) or empty string if is not exist
findFlagUrlByIso3Code(iso3Code)
Returns SVG link of the official flag for a specified country (according to ISO 3166-1 alpha-3 code) or empty string if is not exist
Available Flags
The full list of available flags you can see on the Docs page
if not enough don't be shy and provide merge request ;)
License
Licensed under MIT.