npm.io
5.0.0 • Published 11 months ago

@types/geoip-country

Licence
MIT
Version
5.0.0
Deps
0
Size
5 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/geoip-country

Summary

This package contains type definitions for geoip-country (https://github.com/sapics/geoip-country).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/geoip-country.

index.d.ts

export interface Lookup {
    /** [ <low bound of IP block>, <high bound of IP block> ] */
    range: [number, number];
    /** 2 letter ISO-3166-1 country code https://www.iban.com/country-codes */
    country: string;
    /** Full country name */
    name?: string;
    /** Native country name */
    native?: string;
    /** Full capital name */
    capital?: string;
    continent?: "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
    continent_name?: "Africa" | "Antarctica" | "Asia" | "Europe" | "North America" | "Oceania" | "South America";
    /** ISO 639-1 2 letter language codes */
    languages?: string[];
    /** ISO 4217 currency codes */
    currency?: string[];
    /** Phone number prefixes */
    phone?: string[];
}

export type CmpArgs = number | [number];
export type CmpResult = 1 | -1 | 0 | null;

export function cmp(a: CmpArgs, b: CmpArgs): null | Lookup;
/**
 * @param ip ipv4, ipv6 or "dual stack" IP (e.g. `"::ffff:8.8.8.8"`)
 *
 * @returns null for local IPs and unknown IP ranges, otherwise an object with country info
 */
export function lookup(ip: string | number): null | Lookup;
export function pretty(ip: string | number | Array<string | number>): string;
export function startWatchingDataUpdate(cb?: (err?: Error) => void): void;
export function stopWatchingDataUpdate(): void;

Additional Details

  • Last updated: Mon, 27 Oct 2025 2146 GMT
  • Dependencies: none

Credits

These definitions were written by Jesse Chan.