Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

iran-lib

faeztgh77MIT1.0.22TypeScript support: included

A TypeScript library providing utilities and data related to Iran.

iran, iran-lib, iranian-data, provinces, cities, banks, national-id, iranian-api, typescript-library, javascript-library, persian, iranian-utilities, iranian-tools, iranian-packages, iran-development, tehran, melli-bank, iranian-cities, iranian-provinces, iranian-national-id, farsi, فارسی, ایران, شهرهای ایران, بانک های ایران, کد ملی, استان های ایران, تهران, بانک ملی, کد پیش شماره بانک, کتابخانه جاوا اسکریپت, کتابخانه تایپ اسکریپت, ابزارهای ایرانی, نرم‌افزارهای ایرانی, داده‌های ایرانی, استان و شهرهای ایران

readme

Iran-Lib Github npm version Star on GitHub

Description

iran-lib is a TypeScript library providing a collection of utilities, data, and functionality related to Iran. It includes helpful modules for handling provinces and cities, bank information, and other general-purpose utilities for projects related to Iran.


Installation

Install the library via npm or yarn or pnpm:

npm install iran-lib

or

yarn add iran-lib

or

pnpm add iran-lib

Features

  • Provinces and Cities

    • Fetch provinces and their respective cities.
    • Find cities by province name or provinces by city name.
  • Bank Information

    • Get information about Iranian banks, including bank prefixes and names.
    • Lookup bank names by prefixes or prefixes by bank names.
  • National ID

    • Get city and province information based on national ID prefixes.
    • Retrieve city names by prefixes and vice versa.
  • More to Come!

    • This library is designed to expand with additional Iran-related utilities and datasets in the future.

Usage

National ID

Using the Hook

import { useNationalIdData } from "iran-lib-extended";

const { specificCityByPrefix } = useNationalIdData({
    getCityByPrefix: "169",
});

console.log(specificCityByPrefix); // { prefix: "169", city: "آذرشهر" }

Using the Class

import { NationalId } from "iran-lib-extended";

const nationalIdInstance = new NationalId();

const city = nationalIdInstance.getCityByPrefix("169");
const prefix = nationalIdInstance.getPrefixByCity("آذرشهر");

console.log(city); // { prefix: "169", city: "آذرشهر" }
console.log(prefix); // "169"

Provinces and Cities

Using the Hook

import { useIranProvincesAndCities } from "iran-lib";

const { data, specificProvinceCities } = useIranProvincesAndCities({
    getCitiesByProvinceName: "Tehran",
});

console.log(data); // Full provinces and cities data
console.log(specificProvinceCities); // Cities in Tehran province

Using the Class

import { Provinces } from "iran-lib";

const provincesInstance = new Provinces();

const allProvinces = provincesInstance.getProvinces();
const tehranCities = provincesInstance.getCitiesByProvince("Tehran");
const provinceOfCity = provincesInstance.getProvinceByCityName("Qom");

console.log(allProvinces);
console.log(tehranCities);
console.log(provinceOfCity);

Bank Information

Using the Hook

import { useBankData } from "iran-lib";

const { specificBankByPrefix } = useBankData({
    getBankByPrefix: "603799",
});

console.log(specificBankByPrefix); // { prefix: "603799", bankName: "\u0645\u0644\u06cc" }

Using the Class

import { Banks } from "iran-lib";

const banksInstance = new Banks();

const allBanks = banksInstance.getBanks();
const bank = banksInstance.getBankByPrefix("603799");
const prefix = banksInstance.getPrefixByBankName("\u0645\u0644\u06cc");

console.log(allBanks);
console.log(bank);
console.log(prefix);

Data Sources

  • Province and City Data: Comprehensive dataset of Iranian provinces and their respective cities.
  • Bank Data: List of Iranian banks and their prefixes.
  • National ID Data: Data for Iranian national ID prefixes and related cities/provinces.

Contributing

Contributions are welcome! If you have ideas or improvements, feel free to open an issue or submit a pull request.


License

This project is licensed under the MIT License.


Future Plans

  • More datasets related to Iran's infrastructure and culture.

Support

If you encounter any issues or have questions, feel free to open an issue on GitHub.