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

Package detail

turkey-location-data

ismetcanbyk79Apache-2.01.1.1TypeScript support: included

Turkey province, district and neighborhood data

turkey, location, province, district, neighborhood, turkiye, cities, turkish, provices, turkey-location-data, turkey-cities

readme

🇹🇷 Turkey Location Data

NPM Version License: MIT Build Status

Access Turkey's location data including provinces, districts, neighborhoods, and plate codes with ease.


✨ Features

  • 📍 Get all provinces with their API IDs
  • 🏘️ Get districts by province name or API ID
  • 🏡 Get neighborhoods by district API ID
  • 🚗 Get province name by plate code
  • ⚙️ Written in TypeScript
  • 🚀 Lightweight & fast

📦 Installation

npm install turkey-location-data

🔧 Usage

📍 Get All Provinces

import { getAllProvinces } from "turkey-location-data";

const provinces = getAllProvinces();
// Returns: [{ name: "İstanbul", apiId: 34 }, ...]

🏘️ Get Districts by Province

import {
  getDistrictsByProvinceName,
  getDistrictsByProvinceApiId,
} from "turkey-location-data";

// By province name
const districts = getDistrictsByProvinceName("İstanbul");
// Returns: [{ name: "Kadıköy", apiId: 1234 }, ...]

// By province API ID
const districts2 = getDistrictsByProvinceApiId(34);
// Returns: [{ name: "Kadıköy", apiId: 1234 }, ...]

🏡 Get Neighborhoods

import { getNeighborhoodsByDistrictApiId } from "turkey-location-data";

const neighborhoods = getNeighborhoodsByDistrictApiId(1234);
// Returns: ["Caferağa", "Fenerbahçe", ...]

🚗 Get Province by Plate Code

import { getProvinceNameByPlateCode } from "turkey-location-data";

const province = getProvinceNameByPlateCode(34); // "İstanbul"

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.


📧 Contact

Feel free to contact me with any questions or suggestions.