🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@magic/iso-3166

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@magic/iso-3166

iso-3166 country codes and subdivisions

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
2
Created
Source

@magic/iso-3166

Exports an array of the iso-3166-1 countrycodes and iso-3166-2 subdivisions.

State of January of 2022

html-docs

NPM version Linux Build Status Windows Build Status Coverage Status Known Vulnerabilities

installation

be in a nodejs project

npm install --save-exact @magic/iso-3166

import / usage:

in yourproject.js

import { countries, subdivisions } from '@magic/iso-3166'

// both countries and subdivisions are regular js arrays.

const AfghanistanByName = countries.find(country => country.name === 'Afghanistan')

/* returns
{ name: 'Afghanistan', a2: 'AF', a3: 'AFG', num: '004' }
*/

const AmericanSamoaByAlphaNumeric2 = countries.find(country => country.a2 === 'AS')
const AustraliaByAlphaNumeric3 = countries.find(country => country.a3 === 'AUS')
const AntarcticaByNumeric = countries.find(country => country.num === '010')

const BrasilianSubdivisions = subdivisions.filter(sub => sub.country === 'BR')

const AustrianSubdivisions = subdivisons.filter(sub => sub.country === 'AT')

/* returns
{ country: 'AT', code: '1', name: 'Burgenland', type: 'state' },
{ country: 'AT', code: '2', name: 'Kärnten', type: 'state' },
{ country: 'AT', code: '3', name: 'NiederĂśsterreich', type: 'state' },
{ country: 'AT', code: '4', name: 'OberĂśsterreich', type: 'state' },
{ country: 'AT', code: '5', name: 'Salzburg', type: 'state' },
{ country: 'AT', code: '6', name: 'Steiermark', type: 'state' },
{ country: 'AT', code: '7', name: 'Tirol', type: 'state' },
{ country: 'AT', code: '8', name: 'Vorarlberg', type: 'state' },
{ country: 'AT', code: '9', name: 'Wien', type: 'state' }
*/

changelog

0.0.1

first publish

0.0.2

  • add full list of countries to docs
  • update dependencies

0.0.3

  • update dependencies

0.0.4 - unreleased

...

FAQs

Package last updated on 30 Oct 2025

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