Socket
Socket
Sign inDemoInstall

country-js

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    country-js

Get the country code, name, currency symbol, capital, phone code, latitude and longitude


Version published
Maintainers
1
Created

Readme

Source

country-js

country-js is an npm package designed to provide extensive information about countries, encompassing details such as country code, name, currency symbol, capital city, phone code, latitude, and longitude.

Installation

You can easily install country-js via npm:

npm install country-js --save

Usage


const countryInfo = require('country-js');

// Search by country code, name, currencyCode, currencyName, or symbol
countryInfo.search('austria'); // Returns information about Austria
countryInfo.search('at'); // Returns information about Austria
countryInfo.search('euro'); // Returns information about countries using Euro as currency
countryInfo.search('eur'); // Returns information about countries using Euro as currency
countryInfo.search('€'); // Returns information about countries using Euro as currency

// Example outputs:
/*
[
  {
    code: 'AT',
    name: 'AUSTRIA',
    currency: {
      currencyName: 'EURO',
      currencyCode: 'EUR',
      currencySymbol: '€'
    },
    geo: { latitude: 47.516231, longitude: 14.550072 },
    capital: 'VIENNA',
    phone: '43'
  }
]
*/

// You can search for other countries like 'USA', 'SG' (Singapore), 'IN' (India), etc., and get their information in a similar structured output.

Keywords

FAQs

Last updated on 10 Dec 2023

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc