npm.io
0.1.0 • Published yesterday

azerbaijan-utils

Licence
MIT
Version
0.1.0
Deps
0
Size
385 kB
Vulns
0
Weekly
0

az-utils

Azerbaijan-specific validators, formatters and utilities for Node.js and the browser. Azərbaycana aid validatorlar, formatlayıcılar və köməkçi funksiyalar.

CI License: MIT PRs Welcome

Azerbaijani developers re-implement the same validators over and over — FIN codes, tax IDs (VÖEN), local IBANs, +994 phone numbers, Latin transliteration, manat formatting. az-utils collects them into one small, dependency-free, fully-typed and thoroughly-tested library.

  • Locale-first — built specifically for Azerbaijan's formats.
  • Zero dependencies — tree-shakeable ESM + CJS, ships with types.
  • Tested — 340+ tests; every function is covered.
  • Consistent API — validators return booleans, normalize*/format* return strings, parsers/extractors return the value or null.

Install

npm install azerbaijan-utils

Quick start

import {
  isValidIban,
  formatManat,
  numberToWordsAz,
  normalizePhone,
  toUpperAz,
} from "azerbaijan-utils";

isValidIban("AZ21 NABZ 0000 0000 1370 1000 1944"); // true
formatManat(1234.5);                                // "1 234,50 ₼"
numberToWordsAz(1234);                               // "min iki yüz otuz dörd"
normalizePhone("0501234567");                        // "+994501234567"
toUpperAz("işıq");                                   // "İŞIQ"

Everything is a named export, so you only bundle what you use.

API

iban

isValidIban · normalizeIban · formatIban · generateIban · maskIban · extractBankCode · extractAccount · ibanCountryCode · areIbansEqual — validate (ISO 7064 MOD-97), format, generate and inspect Azerbaijani IBANs.

fin

isValidFin · normalizeFin · maskFin — the 7-character personal ID code.

voen

isValidVoen · normalizeVoen — the 10-digit taxpayer ID.

phone

isValidPhone · normalizePhone (E.164) · formatPhoneInternational · formatPhoneNational · detectOperator · isMobilePhone · isLandlinePhone · arePhonesEqual · phoneToTelLink · phoneDigits.

card

isValidCardNumber (Luhn) · detectCardScheme · formatCardNumber · maskCardNumber · getCardLast4.

swift

isValidSwift · normalizeSwift · parseSwift — AZ BIC codes.

currency

formatManat · parseManat · roundManat · splitManatQepik · sumManat · averageManat · manatToQepik · qepikToManat.

number

formatNumberAz · parseNumberAz · numberToWordsAz · ordinalAz · roundTo · clamp · inRange · sum · average · median · minOf · maxOf · range · percentOf · gcd · lcm · isEven · isOdd.

percent

formatPercentAz · parsePercentAz.

dates

formatDateAz · formatDateShortAz (DD.MM.YYYY) · parseDateShortAz · formatTimeAz · formatDateTimeAz · MONTH_NAMES_AZ · WEEKDAY_NAMES_AZ · weekdayNameAz · isWeekend · isWorkingDay · addWorkingDays · workingDaysBetween · addDays · addMonths · addYears · startOfDay · endOfDay · startOfMonth · endOfMonth · daysBetween · monthsBetween · daysInMonth · dayOfYear · quarterOf · isLeapYear · isSameDay · isSameMonth · isToday · isPast · isFuture · getAge · isValidDateParts.

text

asciiFold · slugify¹ · truncate · capitalizeFirstAz · countWords · countOccurrences · charCount · initials · isAzAlpha · isBlank · maskEmail · normalizeSpaces · reverseText · extractDigits · ensurePrefix · ensureSuffix · zeroPad.

case

toUpperAz · toLowerAz · titleCaseAz — Azerbaijani-correct casing (İ/ı).

slug

slugify · isSlug.

postal

isValidPostalCode · normalizePostalCode.

plate

isValidPlate · normalizePlate · formatPlate · extractPlateRegion.

¹ Format-only checks (FIN, VÖEN, postal, plate, SWIFT) verify the shape, not that the value is officially registered — this is documented in each function's JSDoc.

Contributing

Contributions are very welcome — this project is built together. Adding a utility is a small, self-contained PR. Start with CONTRIBUTING.md and grab a good first issue. Remaining ideas (region/city datasets, public-holiday calendar, LatinCyrillic transliteration) are tracked in ROADMAP.md.

License

MIT az-utils contributors

Keywords