Thai address postcode resolver with fuzzy and bilingual support
npm install thai-postcode-helper

!Node Version

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.
---
- thai-postcode-helper
- Table of Contents
- Installation
- Usage
- Features
- API Reference
- Data Format
- License
---
``bash`
npm install thai-postcode-helper
`js
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']
`
findPostcode(province, district, subdistrict, lang?) string[]
Return:
findPostcodeFuzzy(province, district, subdistrict, lang?) string[]
Return: (with typo tolerance)
findByPostcode(zipcode, lang?) { province, district, subdistrict, zipcode }[]
Return:
suggestSubdistricts(province?, district?, lang?) string[]
Return:
suggestSubdistrictsFuzzy(input, lang?, limit?) string[]
Return:
json
{
"province_th": "ชุมพร",
"province_en": "Chumphon",
"district_th": "เมืองชุมพร",
"district_en": "Mueang Chumphon",
"subdistrict_th": "ท่าตะเภา",
"subdistrict_en": "Thataphao",
"zipcode": "86000"
}
``