Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

world-information

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

world-information

world-information is a comprehensive npm package designed to provide detailed geographical information. It includes data on continents, countries, states, and cities, making it an essential tool for applications that require location-based data.

  • 0.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
0
Weekly downloads
 
Created
Source

WORLD INFORMATION

A package for fetching world information

world-information

Installation

npm install world-information

This repository provides a comprehensive dataset based on the ISO 3166 standard, which includes internationally recognized codes for continents,countries,states & cities. The ISO 3166 standard is a globally accepted system used for identifying countries and their subdivisions, ensuring consistent and reliable data across various applications.
world-information is a comprehensive npm package designed to provide detailed geographical information. It includes data on continents, countries, states, and cities, making it an essential tool for applications that require location-based data.
Features:
  • Continent Data: Features standard codes and names for continents as per ISO 3166-1.
  • Country Data: Includes ISO 3166-1 alpha-2 (2-letter), alpha-3 (3-letter), and numeric codes for countries.
AVAILABLE METHODS & ARRAY:
Continent array
Country array
getCountryByContinentName(continentName);
COMING SOON:
States
Cities
getStatesByCountryName(countryName);
getCitiesByStateName(stateName);
Note : Above lists and methods are currently being enhanced and will be available in future updates.

EXAMPLE TO FETCH CONTINENT LIST :
const worldInformation = require('world-information');

// Get a list of continents
const continents = worldInformation.continentList;
console.log(continents);

// Output:
// [
//   { name: 'Africa', code: 'AF' },
//   { name: 'Antarctica', code: 'AN' },
//   { name: 'Asia', code: 'AS' },
//   { name: 'Europe', code: 'EU' },
//   { name: 'North America', code: 'NA' },
//   { name: 'Oceania', code: 'OC' },
//   { name: 'South America', code: 'SA' }
// ]
The current version includes data for all 7 continents.
EXAMPLE TO FETCH COUNTRY LIST :
const worldInformation = require('world-information');
    
// Get a list of countries
const countries = worldInformation.countryList;
console.log(countries);

// Output (sample):
// [
//   { "name": "Afghanistan", "alpha-2": "AF", "alpha-3": "AFG", "numeric": "004", "continent": "Asia" },
//  { "name": "Albania", "alpha-2": "AL", "alpha-3": "ALB", "numeric": "008", "continent": "Europe" },
//   ...
//   { "name": "Zimbabwe", "alpha-2": "ZW", "alpha-3": "ZWE", "numeric": "716", "continent": "Africa" }
// ]
The current version includes data for all 196 countries.
EXAMPLE TO FILTER COUNTRY LIST BY CONTINENT NAME :
const {getCountryByContinentName} = require("world-information");
// Get a list of countries in asia continent
/*
Make sure the argument name is one of the below continent. I have also configured the JSDoc Annotations, So you will get the suggestions too.
'Africa' | 'Antarctica' | 'Asia' | 'Europe' | 'North America' | 'Oceania' | 'South America'
*/
const asianCountries = getCountryByContinentName("Asia");
console.log(asianCountries);

 // Output (sample):
[
  { "name": "Afghanistan", "alpha-2": "AF", "alpha-3": "AFG", "numeric": "004", "continent": "Asia" },
  { "name": "Armenia", "alpha-2": "AM", "alpha-3": "ARM", "numeric": "051", "continent": "Asia" },
  ...
  { "name": "Yemen", "alpha-2": "YE", "alpha-3": "YEM", "numeric": "887", "continent": "Asia" },
]
CONTRIBUTING:

Contributions are welcome! Please open an issue or submit a pull request on GitHub to help improve this package. ♥♥♥

This description provides a clear overview of the package's current capabilities and future enhancements, making it easier for users to understand and utilize the package.

Keywords

FAQs

Package last updated on 06 Aug 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