Nofinite's standardized country data, flags, and international dial codes for global applications.
npm install @nofinite/localebash
pnpm
pnpm add @nofinite/locale
npm
npm install @nofinite/locale
yarn
yarn add @nofinite/locale
`
$3
`html
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@nofinite/locale/dist/style.css"
/>
`
---
Usage
$3
_(For Javascript/Typescript)_
`ts
import { getCountryByCode, getCountryByDialCode } from '@nofinite/locale';
// Lookup by ISO-2 code (case-insensitive)
const in = getCountryByCode('IN');
// Lookup by dial code
const india = getCountryByDialCode('+91');
// or
const indiaAlt = getCountryByDialCode('91');
console.log(india);
/*
{
name: "India",
iso2: "IN",
dialCode: "+91"
}
*/
`
_(For HTML)_
`html
`
---
$3
Flags are provided via CSS. Import the stylesheet once.
_(For Javascript/Typescript)_
`ts
import "@nofinite/locale/style";
`
_(For HTML)_
`html
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@nofinite/locale/dist/style.css"
/>
`
Flag Classes
| Class | Purpose |
| ---------------- | ------------------------------ |
| .nf-flag | Base flag class (required) |
| .nf-flag-{iso} | Country ISO-2 code (lowercase) |
| .square | Optional 1:1 ratio |
Examples
- Standard (4:3)
- Square (1:1)
- Inside UI Elements
`html
``