🌎
country-info
  • Welcome!
  • Quick Start
  • Changelog
  • Reference
    • Functions
      • Get Continent Information
      • Get Country Information
      • Get All Countries Information
      • Get Country by Top-Level Domain
      • Search Countries
    • Function Signatures
    • Testing
Powered by GitBook
On this page

Was this helpful?

  1. Reference
  2. Functions

Search Countries

The searchCountries function allows you to search for countries based on a keyword in their names, capitals, or codes. You can specify the fields you want to retrieve as an array.

const { searchCountries } = require('countrys-info');

// Search for countries based on a keyword
const countriesByKeyword = searchCountries('united', ['name_en', 'capital_en']);
console.log(countriesByKeyword);
PreviousGet Country by Top-Level DomainNextFunction Signatures

Last updated 1 year ago

Was this helpful?