Code Monkey home page Code Monkey logo

country-flags-svg's Introduction

country-flags-svg

A list of countries with url links to a svg image which you can simply use in your web application

NPM

Coveralls npm

Install

$ npm install country-flags-svg

or

$ yarn add country-flags-svg

Usage

import { findFlagUrlByNationality } from "country-flags-svg";

const flagUrl = findFlagUrlByNationality("Australian");
// => "http://upload.wikimedia.org/wikipedia/commons/8/88/Flag_of_Australia_%28converted%29.svg"
import { countries } from "country-flags-svg";

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.