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

countries-json

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

countries-json

List of all countries with names and ISO 3166-1 codes in all languages in JSON.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Countries JSON

Installation:

npm install countries-json --save

Usage example:

import countriesData from 'countries-json'; // warning: files size with all locales ~3Mb

function getLang () { // browser
    if (navigator.languages !== undefined && navigator.languages.length) {
        return navigator.languages[0];
    } 
    return navigator.userLanguage || navigator.language || navigator.browserLanguage || navigator.systemLanguage;    
}

let countries = countriesData[getLang()]

console.log( countries );

or for single locale:

function getLang () { // browser
    if (navigator.languages !== undefined && navigator.languages.length) {
        return navigator.languages[0];
    } 
    return navigator.userLanguage || navigator.language || navigator.browserLanguage || navigator.systemLanguage;    
}

let countries = require('countries-json/data/' + getLang()); // load countries only for single locale

console.log( countries );

This project using SemVer for versioning. For the versions available, see the tags on this repository.

This project is licensed under the MIT License - see the LICENSE.md file for details

Keywords

FAQs

Package last updated on 20 Jan 2019

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