JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q24600F
  • License MIT

A package for auto-filling addresses in Thailand based on postal codes.

Package Exports

  • theeyoo
  • theeyoo/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (theeyoo) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Theeyoo – Thai Address Autocomplete

A comprehensive npm package for auto-completing Thai addresses based on postal codes. This package provides easy access to Thailand's complete address database including provinces, districts, and subdistricts with both English and Thai names. Data from @thailand-geography-data. See Github repo

Features

  • 🏛️ Complete Database: 77 provinces, thousands of districts and subdistricts
  • 🌐 Bilingual Support: Both English and Thai names
  • 📮 Postal Code Lookup: Find all addresses for any postal code
  • 🔍 Search Functionality: Search by location names
  • 🏗️ Hierarchical Data: Province → District → Subdistrict structure

Installation

npm install theeyoo

API Reference

Functions

autocompleteAddress(postalCode: string): PostalCodeResponse

  • postalCode: A string representing the 5-digit postal code to search for
  • Returns: A PostalCodeResponse object containing an array of matching addresses

Classes

AddressService

A service class for advanced address operations and queries.

Methods:

  • getAddressesByPostalCode(postalCode: string): Address[]: Returns addresses for a postal code
  • getProvinces(): ProvinceData[]: Returns all provinces
  • getDistrictsByProvince(provinceCode: number): DistrictData[]: Returns districts in a province
  • getSubdistrictsByDistrict(provinceCode: number, districtCode: number): SubdistrictData[]: Returns subdistricts in a district
  • searchByName(searchTerm: string, language: 'en' | 'th'): Address[]: Search addresses by name

Interfaces

Address

interface Address {
    district: string;          // District name in English
    districtTh: string;        // District name in Thai
    province: string;          // Province name in English
    provinceTh: string;        // Province name in Thai
    subdistrict: string;       // Subdistrict name in English
    subdistrictTh: string;     // Subdistrict name in Thai
    postalCode: string;        // 5-digit postal code
    provinceCode: number;      // Numeric province code
    districtCode: number;      // Numeric district code
}

PostalCodeResponse

interface PostalCodeResponse {
    addresses: Address[];
}

ProvinceData

interface ProvinceData {
    id: number;
    provinceCode: number;
    provinceNameEn: string;
    provinceNameTh: string;
}

DistrictData

interface DistrictData {
    id: number;
    provinceCode: number;
    districtCode: number;
    districtNameEn: string;
    districtNameTh: string;
    postalCode: number;
}

SubdistrictData

interface SubdistrictData {
    id: number;
    provinceCode: number;
    districtCode: number;
    subdistrictCode: number;
    subdistrictNameEn: string;
    subdistrictNameTh: string;
    postalCode: number;
}

Data Coverage

  • 77 Provinces - All provinces in Thailand
  • 928 Districts - Complete district coverage
  • 7,410+ Subdistricts - Comprehensive subdistrict data
  • Bilingual Names - Both English and Thai names
  • Accurate Postal Codes - Up-to-date postal code mappings

Data Sources

This package uses Thai address data from @thailand-geography-data. See Github repo