New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ac-countrylist

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ac-countrylist

This is a little helper to retrieve a countrylist and query this countrylist.

  • 1.0.12
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-83.78%
Maintainers
1
Weekly downloads
 
Created
Source

AC CountryList

This is a little helper to retrieve a countrylist and query this countrylist.

The countrylist is forked from https://gist.github.com/stefanbauer/bf0720c6846a3cc9b59e

Usage

You can use the countrylist directly by importing countrylist.js. But it is recommended to use this little helper and require this module.

const acCountryList = require('ac-countrylist')

Fetch country list

Return a short list with iso2, country name and spoken languages.

const list = acCountryList.showList()
// -> [{ name: 'Afghanistan',
    iso2: 'af',
    alpha2Code: 'af',
    languages: [ 'ps', 'uz', 'tk' ] }, ...]

Query list

Query the country list (currently only iso2 and iso3 is supported)

const country = acCountryList.query({ iso2: 'de' })
// OR
const country = acCountryList.query({ iso3: 'deu' })

// -> { name: 'Germany',
  capital: 'Berlin',
  altSpellings:
   [ 'DE',
     'Federal Republic of Germany',
     'Bundesrepublik Deutschland' ],
  relevance: '3',
  region: 'Europe',
  subregion: 'Western Europe',
  translations:
   { de: 'Deutschland',
     es: 'Alemania',
     fr: 'Allemagne',
     ja: 'ドイツ',
     it: 'Germania' },
  population: 81083600,
  latlng: [ 51, 9 ],
  demonym: 'German',
  area: 357114,
  gini: 28.3,
  timezones: [ 'UTC+01:00' ],
  borders:
   [ 'AUT', 'BEL', 'CZE', 'DNK', 'FRA', 'LUX', 'NLD', 'POL', 'CHE' ],
  nativeName: 'Deutschland',
  callingCodes: [ '49' ],
  topLevelDomain: [ '.de' ],
  alpha2Code: 'DE',
  alpha3Code: 'DEU',
  currencies: [ 'EUR' ],
  languages: [ 'de' ] }

Fetch random country

Return a random country

const randomCountry = acCountryList.random()
//
{ name: 'Afghanistan',
  iso2: 'af',
  alpha2Code: 'af',
  languages: [ 'ps', 'uz', 'tk' ] 
}

License

MIT License Copyright © 2009-present, AdmiralCloud, Mark Poepping

FAQs

Package last updated on 05 Jun 2024

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc