New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

flag-cc

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flag-cc

A simple component displaying the flag and information for currencies and countries.

latest
Source
npmnpm
Version
2.0.3
Version published
Maintainers
1
Created
Source

flag-cc

is a simple web component that display the flag of the corresponding currency or country code. Use the currency attribute to display the currency flag or use code to display the country flag.

If the flag is not found, it will displays either the currency or the code that was specified by the user.

screenshot

Installation and demo

This library depends on the famous LitElement library. To see the demo locally in action please:

git clone https://github.com/yveslange/flag-cc.git
cd flag-cc && npm install
npm start

Now you can navigate to http://localhost:8000

You can build the source by running npm run build. The built distribution will be located into ./build/. Additionally, you can serve the built

How to use

In your index.html:

  <head>
    <script src="./node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
    <script type="module" src="./node_modules/flag-cc/index.js"></script>

Then you should be able to use <flag-cc> tag anywhere.

<flag-cc currency="CHF"></flag-cc>
<flag-cc currency="CNY"></flag-cc>
<flag-cc currency="CNH"></flag-cc>
<flag-cc currency="ABC"></flag-cc>
<flag-cc code="Unknown"></flag-cc>
<flag-cc code="FR"></flag-cc>

Technical

The flags will be searched in ./node_modules/flag-cc/flags/. If you want to change the path please refer to the property imagesPath.

Properties

PropertyAttributeTypeDefaultDescription
codecodeThe country code (eg: CH, FR, ...)
countrycountryThe corresponding country name
currencycurrencyThe currency code (eg: EUR, CNY, CHF, ...)
flagTypeflag-typestringThe type of the flag ('country' or 'currency')
imagesPathimages-pathstring"./node_modules/flag-cc/flags/"Configures where the images folder is located
isUnknownis-unknownbooleanIs true if the country or currency code is unknown. This is set by
flag-cc if the flag was not found.

Methods

MethodTypeDescription
getCountryFlag(code?: string): StringRetreive the country flag using the code

code: The country code.
getCurrencyFlag(currency: string): StringRetreive the currency flag using the currency name.

currency: The currency name to use (eg: CHF, EUR, ...).

Keywords

flags

FAQs

Package last updated on 09 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts