UNPKG

thai-postcode-helper

Version:

Thai address postcode resolver with fuzzy and bilingual support

15 lines (14 loc) 435 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.normalize = normalize; exports.matchName = matchName; function normalize(input) { return input .replace(/\s+/g, '') .replace(/[^\u0E00-\u0E7F\w]/g, '') .toLowerCase(); } function matchName(obj, input) { const norm = normalize(input); return normalize(obj.name) === norm || normalize(obj.name_en || '') === norm; }