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

country-seeker

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

country-seeker

This is a Node.js package that allows you to search for countries using different criteria such as country code, dial code, flag, or country name. It exports several functions that can be used in your Node.js projects to retrieve country data.

  • 0.1.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
45
decreased by-27.42%
Maintainers
1
Weekly downloads
 
Created
Source

Country Seeker Node Package

This is a Node.js package that allows you to search for countries using different criteria such as country code, dial code, flag, or country name. It exports several functions that can be used in your Node.js projects to retrieve country data.

Installation

To use this package, you can install it from npm using the following command:

npm install country-seeker

Usage

To use this package, you first need to import it into your project:

import { getCountries, useCountry, useDialCode, useFlag, useCountryName, useCountryCode } from "country-seeker";

getCountries

This function returns an array of all the countries in the package's data:

const countries = getCountries();
console.log(countries);

useCountry

This function takes an object with two properties, type and value, and returns the first country that matches the given criteria:

const countryByCode = useCountry({ type: 'code', value: 'US' });
console.log(countryByCode);

const countryByDialCode = useCountry({ type: 'dial_code', value: '+1' });
console.log(countryByDialCode);

const countryByFlag = useCountry({ type: 'flag', value: '🇺🇸' });
console.log(countryByFlag);

const countryByName = useCountry({ type: 'name', value: 'United States' });
console.log(countryByName);

useDialCode

This function takes a value parameter, which represents the dial code of the country, and returns the first country that matches the given dial code:

const country = useDialCode({ value: '+1' });
console.log(country);

useFlag

This function takes a value parameter, which represents the flag of the country, and returns the first country that matches the given flag:

const country = useFlag({ value: '🇺🇸' });
console.log(country);

useCountryName

This function takes a value parameter, which represents the name of the country, and returns the first country that matches the given name::

const country = useCountryName({ value: 'United States' });
console.log(country);

useCountryCode

This function takes a value parameter, which represents the code of the country, and returns the first country that matches the given code:

const country = useCountryCode({ value: 'US' });
console.log(country);

Contributing

If you find a bug or have a feature request, please open an issue on the GitHub repository . Pull requests are also welcome. .

country-seeker

FAQs

Package last updated on 02 May 2023

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