Socket
Socket
Sign inDemoInstall

iso-3166-utils

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    iso-3166-utils

A helper to get country codes following the ISO 3316


Version published
Weekly downloads
1
decreased by-90%
Maintainers
1
Install size
40.7 kB
Created
Weekly downloads
 

Readme

Source

iso-3166-utils

NPM version Bundle size MIT

A helper to get country codes following the ISO 3316

Install

npm install iso-3166-utils

Usage

You can get all the countries just calling

import { country } from "iso-3166-utils";

const countries = country.data;

You can get a country by its name with getFromName:

import { country } from "iso-3166-utils";

const US = country.getFromName("United States of America");

You can get a country by its alpha2 value with getFromAlpha2:

import { country } from "iso-3166-utils";

const US = country.getFromAlpha2("US");

You can get a country by its alpha3 value with getFromAlpha3:

import { country } from "iso-3166-utils";

const US = country.getFromAlpha3("USA");

You can get a country by its code with getFromAlpha3:

import { country } from "iso-3166-utils";

const US = country.getFromCode("840");

And you can have the same for subdivisions, like AK:

import { subdivision } from "iso-3166-utils";

const AK = subdivision("us").getFromCode("AK");

Or you can get it from the name:

import { subdivision } from "iso-3166-utils";

const AK = subdivision("us").getFromName("Alaska");

You can find a full list of countries from the source

You can find a full list of subdivisions from the source

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Keywords

FAQs

Last updated on 07 Mar 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