thaizip 0.7.3 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -1
- package/dist/data.cjs +40 -62
- package/dist/data.d.cts +14 -1
- package/dist/data.d.ts +14 -1
- package/dist/data.js +40 -63
- package/dist/defaultData.js +6 -0
- package/dist/index.cjs +17 -16
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +17 -16
- package/dist/react.cjs +17 -16
- package/dist/react.js +17 -16
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
# thaizip
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/thaizip)
|
|
4
|
+
[](https://www.npmjs.com/package/thaizip)
|
|
5
|
+
[](https://github.com/naay99999/thai-zip/blob/main/LICENSE)
|
|
6
|
+
|
|
3
7
|
Fast fuzzy autocomplete for Thai addresses — subdistrict, district, province, postal code. Thai and English input, zero runtime dependencies, React optional.
|
|
4
8
|
|
|
5
9
|
**Docs:** https://naay99999.github.io/thai-zip/ (ไทย / [English](https://naay99999.github.io/thai-zip/en/))
|
|
6
10
|
|
|
11
|
+
| Thai input | English input (romanization alias) |
|
|
12
|
+
|---|---|
|
|
13
|
+
|  |  |
|
|
14
|
+
|
|
7
15
|
```bash
|
|
8
16
|
npm install thaizip
|
|
9
17
|
```
|
|
@@ -12,7 +20,7 @@ npm install thaizip
|
|
|
12
20
|
|---|---|
|
|
13
21
|
| `thaizip` | core functions + types (no React code, 4.4 KB gzip) |
|
|
14
22
|
| `thaizip/react` | `useThaiAddressAutocomplete` (ships `"use client"`) |
|
|
15
|
-
| `thaizip/data` | `loadDefaultIndex`, `clearDefaultIndex` (
|
|
23
|
+
| `thaizip/data` | `loadDefaultIndex`, `clearDefaultIndex`, `getDefaultIndexIfLoaded` (2.3 KB gzip, plus a 114 KB gzip data chunk fetched lazily on the first `loadDefaultIndex()` call) |
|
|
16
24
|
|
|
17
25
|
## Quick start
|
|
18
26
|
|
|
@@ -59,6 +67,8 @@ lookupByZipCode(index, '45000') // exact
|
|
|
59
67
|
lookupByZipCode(index, '450') // prefix
|
|
60
68
|
```
|
|
61
69
|
|
|
70
|
+
Direct ZIP lookup rejects raw inputs longer than 1000 characters before scanning them. A finite `zipLimit` also bounds how many matching records are collected.
|
|
71
|
+
|
|
62
72
|
### English input
|
|
63
73
|
|
|
64
74
|
The dataset indexes official RTGS spellings, so `bang rak` and `chatuchak` work directly. 87 common non-RTGS spellings are mapped on first: `lardprao` → `lat phrao`, `ladkrabang` → `lat krabang`, `krungthep` → `bangkok`. It is a curated dictionary, not a transliterator — unlisted spellings still miss. Opt out with `romanizationAliases: false`.
|