JSPM

thai-postcode-helper

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

Thai address postcode resolver with fuzzy and bilingual support

Package Exports

  • thai-postcode-helper
  • thai-postcode-helper/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 (thai-postcode-helper) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

thai-postcode-helper

npm version License: MIT Node Version npm downloads

A Thai address postcode resolver with fuzzy search and bilingual (Thai/English) support.

Easily map provinces, districts, subdistricts to zipcodes in Thailand — with typo-tolerant search.


Table of Contents


Installation

npm install thai-postcode-helper

Usage

import {
  findPostcode,
  findPostcodeFuzzy,
  findByPostcode,
  suggestSubdistricts,
  suggestSubdistrictsFuzzy
} from 'thai-postcode-helper'

// Basic lookup
findPostcode('ชุมพร', 'เมืองชุมพร', 'ท่าตะเภา') // ['86000']
findPostcode('Chumphon', 'Mueang Chumphon', 'Thataphao', 'en') // ['86000']

// Reverse lookup
findByPostcode('86000') // [{ province, district, subdistrict, zipcode }]

// Suggestions
suggestSubdistricts('ชุมพร', 'เมืองชุมพร') // ['ท่าตะเภา', ...]

// Fuzzy search (tolerates typos)
findPostcodeFuzzy('Chumpon', 'Muang Choomphon', 'Tha Tapao', 'en') // ['86000']
suggestSubdistrictsFuzzy('Thataphaw', 'en') // ['Tha Taphao']

Features

  • Full Thai address mapping: province → district → subdistrict → zipcode
  • Supports both Thai and English
  • Fuzzy search (powered by Fuse.js)
  • Typo-tolerant and normalized matching
  • Data included in package (data/data.json)

API Reference

findPostcode(province, district, subdistrict, lang?)
Return: string[]

findPostcodeFuzzy(province, district, subdistrict, lang?)
Return: string[] (with typo tolerance)

findByPostcode(zipcode, lang?)
Return: { province, district, subdistrict, zipcode }[]

suggestSubdistricts(province?, district?, lang?)
Return: string[]

suggestSubdistrictsFuzzy(input, lang?, limit?)
Return: string[]

Data Format

The package includes a flat JSON dataset:

{
  "province_th": "ชุมพร",
  "province_en": "Chumphon",
  "district_th": "เมืองชุมพร",
  "district_en": "Mueang Chumphon",
  "subdistrict_th": "ท่าตะเภา",
  "subdistrict_en": "Thataphao",
  "zipcode": "86000"
}

License

MIT © 2025 Chawit Tanachochaow