Function searchByCapital

  • Type Parameters

    Parameters

    • capitalCity: string

      The capital city to search for

    • Optional options: {
          fields?: F[];
      }

      The options

      • Optional fields?: F[]

        The fields to keep in the response

    Returns Promise<Nullable<Pick<Country, F>[]>>

    The matching countries

    Description

    Search among the countries by their capital city

    Example

    const countries = await searchByCapital('washington');
    const countries = await searchByCapital('washington', { fields: ['name', 'capital'] });