@mailwoman/codex 4.0.0

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.
Files changed (113) hide show
  1. package/out/ca/index.d.ts +12 -0
  2. package/out/ca/index.d.ts.map +1 -0
  3. package/out/ca/index.js +12 -0
  4. package/out/ca/index.js.map +1 -0
  5. package/out/ca/postal-code.d.ts +74 -0
  6. package/out/ca/postal-code.d.ts.map +1 -0
  7. package/out/ca/postal-code.js +100 -0
  8. package/out/ca/postal-code.js.map +1 -0
  9. package/out/ca/province.d.ts +114 -0
  10. package/out/ca/province.d.ts.map +1 -0
  11. package/out/ca/province.js +79 -0
  12. package/out/ca/province.js.map +1 -0
  13. package/out/ca/street-type.d.ts +57 -0
  14. package/out/ca/street-type.d.ts.map +1 -0
  15. package/out/ca/street-type.js +156 -0
  16. package/out/ca/street-type.js.map +1 -0
  17. package/out/de/bundesland.d.ts +124 -0
  18. package/out/de/bundesland.d.ts.map +1 -0
  19. package/out/de/bundesland.js +81 -0
  20. package/out/de/bundesland.js.map +1 -0
  21. package/out/de/index.d.ts +12 -0
  22. package/out/de/index.d.ts.map +1 -0
  23. package/out/de/index.js +12 -0
  24. package/out/de/index.js.map +1 -0
  25. package/out/de/postleitzahl.d.ts +108 -0
  26. package/out/de/postleitzahl.d.ts.map +1 -0
  27. package/out/de/postleitzahl.js +63 -0
  28. package/out/de/postleitzahl.js.map +1 -0
  29. package/out/de/street-type.d.ts +58 -0
  30. package/out/de/street-type.d.ts.map +1 -0
  31. package/out/de/street-type.js +79 -0
  32. package/out/de/street-type.js.map +1 -0
  33. package/out/fr/code-postal.d.ts +68 -0
  34. package/out/fr/code-postal.d.ts.map +1 -0
  35. package/out/fr/code-postal.js +84 -0
  36. package/out/fr/code-postal.js.map +1 -0
  37. package/out/fr/departement.d.ts +538 -0
  38. package/out/fr/departement.d.ts.map +1 -0
  39. package/out/fr/departement.js +127 -0
  40. package/out/fr/departement.js.map +1 -0
  41. package/out/fr/index.d.ts +13 -0
  42. package/out/fr/index.d.ts.map +1 -0
  43. package/out/fr/index.js +13 -0
  44. package/out/fr/index.js.map +1 -0
  45. package/out/fr/region.d.ts +113 -0
  46. package/out/fr/region.d.ts.map +1 -0
  47. package/out/fr/region.js +76 -0
  48. package/out/fr/region.js.map +1 -0
  49. package/out/fr/voie.d.ts +64 -0
  50. package/out/fr/voie.d.ts.map +1 -0
  51. package/out/fr/voie.js +88 -0
  52. package/out/fr/voie.js.map +1 -0
  53. package/out/gb/country.d.ts +51 -0
  54. package/out/gb/country.d.ts.map +1 -0
  55. package/out/gb/country.js +56 -0
  56. package/out/gb/country.js.map +1 -0
  57. package/out/gb/index.d.ts +14 -0
  58. package/out/gb/index.d.ts.map +1 -0
  59. package/out/gb/index.js +14 -0
  60. package/out/gb/index.js.map +1 -0
  61. package/out/gb/postcode-area.d.ts +46 -0
  62. package/out/gb/postcode-area.d.ts.map +1 -0
  63. package/out/gb/postcode-area.js +101 -0
  64. package/out/gb/postcode-area.js.map +1 -0
  65. package/out/gb/postcode.d.ts +73 -0
  66. package/out/gb/postcode.d.ts.map +1 -0
  67. package/out/gb/postcode.js +88 -0
  68. package/out/gb/postcode.js.map +1 -0
  69. package/out/gb/street-type.d.ts +36 -0
  70. package/out/gb/street-type.d.ts.map +1 -0
  71. package/out/gb/street-type.js +86 -0
  72. package/out/gb/street-type.js.map +1 -0
  73. package/out/index.d.ts +27 -0
  74. package/out/index.d.ts.map +1 -0
  75. package/out/index.js +27 -0
  76. package/out/index.js.map +1 -0
  77. package/out/jp/address-unit.d.ts +72 -0
  78. package/out/jp/address-unit.d.ts.map +1 -0
  79. package/out/jp/address-unit.js +78 -0
  80. package/out/jp/address-unit.js.map +1 -0
  81. package/out/jp/index.d.ts +13 -0
  82. package/out/jp/index.d.ts.map +1 -0
  83. package/out/jp/index.js +13 -0
  84. package/out/jp/index.js.map +1 -0
  85. package/out/jp/postal-code.d.ts +63 -0
  86. package/out/jp/postal-code.d.ts.map +1 -0
  87. package/out/jp/postal-code.js +77 -0
  88. package/out/jp/postal-code.js.map +1 -0
  89. package/out/jp/prefecture.d.ts +347 -0
  90. package/out/jp/prefecture.d.ts.map +1 -0
  91. package/out/jp/prefecture.js +147 -0
  92. package/out/jp/prefecture.js.map +1 -0
  93. package/out/postcode-systems.d.ts +31 -0
  94. package/out/postcode-systems.d.ts.map +1 -0
  95. package/out/postcode-systems.js +58 -0
  96. package/out/postcode-systems.js.map +1 -0
  97. package/out/us/index.d.ts +12 -0
  98. package/out/us/index.d.ts.map +1 -0
  99. package/out/us/index.js +12 -0
  100. package/out/us/index.js.map +1 -0
  101. package/out/us/state.d.ts +26 -0
  102. package/out/us/state.d.ts.map +1 -0
  103. package/out/us/state.js +84 -0
  104. package/out/us/state.js.map +1 -0
  105. package/out/us/street-suffix.d.ts +499 -0
  106. package/out/us/street-suffix.d.ts.map +1 -0
  107. package/out/us/street-suffix.js +313 -0
  108. package/out/us/street-suffix.js.map +1 -0
  109. package/out/us/zipcode.d.ts +184 -0
  110. package/out/us/zipcode.d.ts.map +1 -0
  111. package/out/us/zipcode.js +127 -0
  112. package/out/us/zipcode.js.map +1 -0
  113. package/package.json +34 -0
@@ -0,0 +1,313 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * USPS Publication 28, Appendix C — Postal Service Standard Suffix Abbreviations.
7
+ *
8
+ * For each canonical suffix the value lists every recognized variant in USPS-published order; the
9
+ * first variant is the preferred USPS abbreviation (e.g. `AVENUE → ["AVE", "AV", "AVEN", "AVENU",
10
+ * "AVN", "AVNUE"]` — `AVE` is what the post office prints).
11
+ *
12
+ * This module is the single home for the USPS suffix table. It carries both the synthesis-layer
13
+ * helpers (`US_STREET_SUFFIX_PREFERRED_ABBR`, `matchCase`, `matchTrailingSuffix` — used by
14
+ * `@mailwoman/corpus`) and the richer branded-type lookup (`StreetSuffix`, `lookupStreetSuffix`,
15
+ * `isStreetSuffix`) salvaged from the original isp-nexus `postal/suffix.ts`. The data is verbatim
16
+ * USPS Pub-28; the two APIs share one underlying record.
17
+ *
18
+ * Salvaged 2026-05-17 (data) / 2026-06-03 (types) from
19
+ * `isp-nexus/universe@6eeb7bd99643a6d62a8b8abbd50968a1e492b90b` `mailwoman/postal/suffix.ts`
20
+ * (originally copyright Sister Software; both projects are AGPL-3.0).
21
+ * @see {@link https://pe.usps.com/text/pub28/28apc_002.htm USPS Street Suffix Abbreviations}
22
+ */
23
+ /**
24
+ * Canonical USPS street suffix → list of recognized variants. The first variant in each list is the
25
+ * preferred USPS abbreviation. Keys + values are uppercase per the publication.
26
+ */
27
+ export const US_STREET_SUFFIX_VARIANTS = {
28
+ ALLEY: ["ALY", "ALLEE", "ALLY"],
29
+ ANEX: ["ANX", "ANNEX", "ANNX"],
30
+ ARCADE: ["ARC"],
31
+ AVENUE: ["AVE", "AV", "AVEN", "AVENU", "AVN", "AVNUE"],
32
+ BAYOU: ["BYU", "BAYOO"],
33
+ BEACH: ["BCH"],
34
+ BEND: ["BND"],
35
+ BLUFF: ["BLF", "BLUF"],
36
+ BLUFFS: ["BLFS"],
37
+ BOTTOM: ["BTM", "BOT", "BOTTM"],
38
+ BOULEVARD: ["BLVD", "BOUL", "BOULV"],
39
+ BRANCH: ["BR", "BRNCH"],
40
+ BRIDGE: ["BRG", "BRDGE"],
41
+ BROOK: ["BRK"],
42
+ BROOKS: ["BRKS"],
43
+ BURG: ["BG"],
44
+ BURGS: ["BGS"],
45
+ BYPASS: ["BYP", "BYPA", "BYPAS", "BYPS"],
46
+ CAMP: ["CP", "CMP"],
47
+ CANYON: ["CYN", "CANYN", "CNYN"],
48
+ CAPE: ["CPE"],
49
+ CAUSEWAY: ["CSWY", "CAUSWA"],
50
+ CENTER: ["CTR", "CEN", "CENT", "CENTR", "CENTRE", "CNTER", "CNTR"],
51
+ CENTERS: ["CTRS"],
52
+ CIRCLE: ["CIR", "CIRC", "CIRCL", "CRCL", "CRCLE"],
53
+ CIRCLES: ["CIRS"],
54
+ CLIFF: ["CLF"],
55
+ CLIFFS: ["CLFS"],
56
+ CLUB: ["CLB"],
57
+ COMMON: ["CMN"],
58
+ COMMONS: ["CMNS"],
59
+ CORNER: ["COR"],
60
+ CORNERS: ["CORS"],
61
+ COURSE: ["CRSE"],
62
+ COURT: ["CT"],
63
+ COURTS: ["CTS"],
64
+ COVE: ["CV"],
65
+ COVES: ["CVS"],
66
+ CREEK: ["CRK"],
67
+ CRESCENT: ["CRES", "CRSENT", "CRSNT"],
68
+ CREST: ["CRST"],
69
+ CROSSING: ["XING", "CRSSNG"],
70
+ CROSSROAD: ["XRD"],
71
+ CROSSROADS: ["XRDS"],
72
+ CURVE: ["CURV"],
73
+ DALE: ["DL"],
74
+ DAM: ["DM"],
75
+ DIVIDE: ["DV", "DIV", "DVD"],
76
+ DRIVE: ["DR", "DRIV", "DRV"],
77
+ DRIVES: ["DRS"],
78
+ ESTATE: ["EST"],
79
+ ESTATES: ["ESTS"],
80
+ EXPRESSWAY: ["EXPY", "EXP", "EXPR", "EXPRESS", "EXPW"],
81
+ EXTENSION: ["EXT", "EXTN", "EXTNSN"],
82
+ EXTENSIONS: ["EXTS"],
83
+ FALL: ["FALL"],
84
+ FALLS: ["FLS"],
85
+ FERRY: ["FRY", "FRRY"],
86
+ FIELD: ["FLD"],
87
+ FIELDS: ["FLDS"],
88
+ FLAT: ["FLT"],
89
+ FLATS: ["FLTS"],
90
+ FORD: ["FRD"],
91
+ FORDS: ["FRDS"],
92
+ FOREST: ["FRST", "FORESTS"],
93
+ FORGE: ["FRG", "FORG"],
94
+ FORGES: ["FRGS"],
95
+ FORK: ["FRK"],
96
+ FORKS: ["FRKS"],
97
+ FORT: ["FT", "FRT"],
98
+ FREEWAY: ["FWY", "FREEWY", "FRWAY", "FRWY"],
99
+ GARDEN: ["GDN", "GARDN", "GRDEN", "GRDN"],
100
+ GARDENS: ["GDNS", "GRDNS"],
101
+ GATEWAY: ["GTWY", "GATEWY", "GATWAY", "GTWAY"],
102
+ GLEN: ["GLN"],
103
+ GLENS: ["GLNS"],
104
+ GREEN: ["GRN"],
105
+ GREENS: ["GRNS"],
106
+ GROVE: ["GRV", "GROV"],
107
+ GROVES: ["GRVS"],
108
+ HARBOR: ["HBR", "HARB", "HARBR", "HRBOR"],
109
+ HARBORS: ["HBRS"],
110
+ HAVEN: ["HVN"],
111
+ HEIGHTS: ["HTS", "HT"],
112
+ HIGHWAY: ["HWY", "HIGHWY", "HIWAY", "HIWY", "HWAY"],
113
+ HILL: ["HL"],
114
+ HILLS: ["HLS"],
115
+ HOLLOW: ["HOLW", "HLLW", "HOLLOWS", "HOLWS"],
116
+ INLET: ["INLT"],
117
+ ISLAND: ["IS", "ISLND"],
118
+ ISLANDS: ["ISS", "ISLNDS"],
119
+ ISLE: ["ISLE", "ISLES"],
120
+ JUNCTION: ["JCT", "JCTION", "JCTN", "JUNCTN", "JUNCTON"],
121
+ JUNCTIONS: ["JCTS", "JCTNS"],
122
+ KEY: ["KY"],
123
+ KEYS: ["KYS"],
124
+ KNOLL: ["KNL", "KNOL"],
125
+ KNOLLS: ["KNLS"],
126
+ LAKE: ["LK"],
127
+ LAKES: ["LKS"],
128
+ LAND: ["LAND"],
129
+ LANDING: ["LNDG", "LNDNG"],
130
+ LANE: ["LN"],
131
+ LIGHT: ["LGT"],
132
+ LIGHTS: ["LGTS"],
133
+ LOAF: ["LF"],
134
+ LOCK: ["LCK"],
135
+ LOCKS: ["LCKS"],
136
+ LODGE: ["LDG", "LDGE", "LODG"],
137
+ LOOP: ["LOOP", "LOOPS"],
138
+ MALL: ["MALL"],
139
+ MANOR: ["MNR"],
140
+ MANORS: ["MNRS"],
141
+ MEADOW: ["MDW"],
142
+ MEADOWS: ["MDWS", "MDW", "MEDOWS"],
143
+ MEWS: ["MEWS"],
144
+ MILL: ["ML"],
145
+ MILLS: ["MLS"],
146
+ MISSION: ["MSN", "MISSN", "MSSN"],
147
+ MOTORWAY: ["MTWY"],
148
+ MOUNT: ["MT", "MNT"],
149
+ MOUNTAIN: ["MTN", "MNTAIN", "MNTN", "MOUNTIN", "MTIN"],
150
+ MOUNTAINS: ["MTNS", "MNTNS"],
151
+ NECK: ["NCK"],
152
+ ORCHARD: ["ORCH", "ORCHRD"],
153
+ OVAL: ["OVAL", "OVL"],
154
+ OVERPASS: ["OPAS"],
155
+ PARK: ["PARK", "PRK", "PARKS"],
156
+ PARKWAY: ["PKWY", "PARKWY", "PKWAY", "PKY"],
157
+ PARKWAYS: ["PKWY", "PKWYS"],
158
+ PASS: ["PASS"],
159
+ PASSAGE: ["PSGE"],
160
+ PATH: ["PATH", "PATHS"],
161
+ PIKE: ["PIKE", "PIKES"],
162
+ PINE: ["PNE"],
163
+ PINES: ["PNES"],
164
+ PLACE: ["PL"],
165
+ PLAIN: ["PLN"],
166
+ PLAINS: ["PLNS"],
167
+ PLAZA: ["PLZ", "PLZA"],
168
+ POINT: ["PT"],
169
+ POINTS: ["PTS"],
170
+ PORT: ["PRT"],
171
+ PORTS: ["PRTS"],
172
+ PRAIRIE: ["PR", "PRR"],
173
+ RADIAL: ["RADL", "RAD", "RADIEL"],
174
+ RAMP: ["RAMP"],
175
+ RANCH: ["RNCH", "RANCHES", "RNCHS"],
176
+ RAPID: ["RPD"],
177
+ RAPIDS: ["RPDS"],
178
+ REST: ["RST"],
179
+ RIDGE: ["RDG", "RDGE"],
180
+ RIDGES: ["RDGS"],
181
+ RIVER: ["RIV", "RVR", "RIVR"],
182
+ ROAD: ["RD"],
183
+ ROADS: ["RDS"],
184
+ ROUTE: ["RTE"],
185
+ ROW: ["ROW"],
186
+ RUE: ["RUE"],
187
+ RUN: ["RUN"],
188
+ SHOAL: ["SHL"],
189
+ SHOALS: ["SHLS"],
190
+ SHORE: ["SHR", "SHOAR"],
191
+ SHORES: ["SHRS", "SHOARS"],
192
+ SKYWAY: ["SKWY"],
193
+ SPRING: ["SPG", "SPNG", "SPRNG"],
194
+ SPRINGS: ["SPGS", "SPNGS", "SPRNGS"],
195
+ SPUR: ["SPUR"],
196
+ SPURS: ["SPUR"],
197
+ SQUARE: ["SQ", "SQR", "SQRE", "SQU"],
198
+ SQUARES: ["SQS", "SQRS"],
199
+ STATION: ["STA", "STATN", "STN"],
200
+ STRAVENUE: ["STRA", "STRAV", "STRAVEN", "STRAVN", "STRVN", "STRVNUE"],
201
+ STREAM: ["STRM", "STREME"],
202
+ STREET: ["ST", "STRT", "STR"],
203
+ STREETS: ["STS"],
204
+ SUMMIT: ["SMT", "SUMIT", "SUMITT"],
205
+ TERRACE: ["TER", "TERR"],
206
+ THROUGHWAY: ["TRWY"],
207
+ TRACE: ["TRCE", "TRACES"],
208
+ TRACK: ["TRAK", "TRACKS", "TRK", "TRKS"],
209
+ TRAFFICWAY: ["TRFY"],
210
+ TRAIL: ["TRL", "TRAILS", "TRLS"],
211
+ TRAILER: ["TRLR", "TRLRS"],
212
+ TUNNEL: ["TUNL", "TUNEL", "TUNLS", "TUNNELS", "TUNNL"],
213
+ TURNPIKE: ["TPKE", "TRNPK", "TURNPK"],
214
+ UNDERPASS: ["UPAS"],
215
+ UNION: ["UN"],
216
+ UNIONS: ["UNS"],
217
+ VALLEY: ["VLY", "VALLY", "VLLY"],
218
+ VALLEYS: ["VLYS"],
219
+ VIADUCT: ["VIA", "VDCT", "VIADCT"],
220
+ VIEW: ["VW"],
221
+ VIEWS: ["VWS"],
222
+ VILLAGE: ["VLG", "VILL", "VILLAG", "VILLG", "VILLIAGE"],
223
+ VILLAGES: ["VLGS"],
224
+ VILLE: ["VL"],
225
+ VISTA: ["VIS", "VIST", "VST", "VSTA"],
226
+ WALK: ["WALK"],
227
+ WALKS: ["WALK"],
228
+ WALL: ["WALL"],
229
+ WAY: ["WAY", "WY"],
230
+ WAYS: ["WAYS"],
231
+ WELL: ["WL"],
232
+ WELLS: ["WLS"],
233
+ };
234
+ /**
235
+ * Inverse lookup: every variant abbreviation OR full canonical word → its canonical key. Built once
236
+ * at module load, lowercase-keyed for case-insensitive matching (`street` → `"STREET"`, `st` →
237
+ * `"STREET"`, `strt` → `"STREET"`, …).
238
+ */
239
+ export const US_STREET_SUFFIX_LOOKUP = (() => {
240
+ const out = new Map();
241
+ for (const canonical of Object.keys(US_STREET_SUFFIX_VARIANTS)) {
242
+ out.set(canonical.toLowerCase(), canonical);
243
+ for (const variant of US_STREET_SUFFIX_VARIANTS[canonical]) {
244
+ // Don't overwrite — first canonical that claims a variant wins (matches USPS Pub-28's
245
+ // ordering). E.g. "WALK" and "WALKS" both list "WALK" as a variant; "WALK" wins because it
246
+ // sorts first in `Object.keys`.
247
+ if (!out.has(variant.toLowerCase()))
248
+ out.set(variant.toLowerCase(), canonical);
249
+ }
250
+ }
251
+ return out;
252
+ })();
253
+ /** Preferred USPS abbreviation per canonical (`AVENUE → "AVE"`, `STREET → "ST"`). */
254
+ export const US_STREET_SUFFIX_PREFERRED_ABBR = Object.fromEntries(Object.keys(US_STREET_SUFFIX_VARIANTS).map((k) => [k, US_STREET_SUFFIX_VARIANTS[k][0]]));
255
+ /**
256
+ * Apply `target`'s letters in the same case-pattern as `reference`. Three patterns covered:
257
+ *
258
+ * - All-uppercase reference (`"AVE"`) → uppercase target (`"AVENUE"`).
259
+ * - All-lowercase reference (`"ave"`) → lowercase target (`"avenue"`).
260
+ * - Anything else (`"Ave"`, `"aVe"`) → title-case target (`"Avenue"`).
261
+ */
262
+ export function matchCase(target, reference) {
263
+ if (!reference)
264
+ return target;
265
+ if (reference === reference.toUpperCase())
266
+ return target.toUpperCase();
267
+ if (reference === reference.toLowerCase())
268
+ return target.toLowerCase();
269
+ return target.charAt(0).toUpperCase() + target.slice(1).toLowerCase();
270
+ }
271
+ /**
272
+ * If the last whitespace-separated word of `street` is a known USPS suffix variant, return the
273
+ * canonical key and the matched word. Returns null if the trailing word isn't a known suffix.
274
+ */
275
+ export function matchTrailingSuffix(street) {
276
+ const trimmed = street.trim();
277
+ if (!trimmed)
278
+ return null;
279
+ const parts = trimmed.split(/\s+/);
280
+ const last = parts[parts.length - 1];
281
+ const canonical = US_STREET_SUFFIX_LOOKUP.get(last.toLowerCase());
282
+ if (!canonical)
283
+ return null;
284
+ return { canonical, matched: last };
285
+ }
286
+ // ── Branded-type lookup (salvaged from isp-nexus postal/suffix.ts) ───────────────────────────────
287
+ // The record above is the data; the types below give callers a precise StreetSuffix / abbreviation
288
+ // vocabulary and a type-safe lookup, without a second copy of the table.
289
+ /**
290
+ * The USPS suffix record, under its original isp-nexus name. Aliases
291
+ * {@link US_STREET_SUFFIX_VARIANTS}.
292
+ */
293
+ export const StreetSuffixAbbreviationRecord = US_STREET_SUFFIX_VARIANTS;
294
+ export function lookupStreetSuffix(input) {
295
+ if (!input || typeof input !== "string")
296
+ return null;
297
+ const suffix = US_STREET_SUFFIX_LOOKUP.get(input.trim().toLowerCase());
298
+ if (!suffix)
299
+ return null;
300
+ return { suffix, abbreviation: US_STREET_SUFFIX_VARIANTS[suffix][0] };
301
+ }
302
+ /** Type-predicate: is the input a canonical USPS street suffix (uppercase full word, e.g. "STREET")? */
303
+ export function isStreetSuffix(input) {
304
+ return typeof input === "string" && Object.hasOwn(US_STREET_SUFFIX_VARIANTS, input);
305
+ }
306
+ /**
307
+ * True when a token is any USPS street suffix or abbreviation (case-insensitive) — `"St"`,
308
+ * `"BLVD"`, `"trail"`.
309
+ */
310
+ export function isStreetSuffixToken(input) {
311
+ return typeof input === "string" && US_STREET_SUFFIX_LOOKUP.has(input.trim().toLowerCase());
312
+ }
313
+ //# sourceMappingURL=street-suffix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"street-suffix.js","sourceRoot":"","sources":["../../us/street-suffix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACxC,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC;IAC/B,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,MAA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AoG;AACpG,mGAAmG;AACnG,yEAAyE;AAEzE;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,yBAAyB,CAAA;AA2BvE,MAAM,UAAU,kBAAkB,CAAC,KAAgC;IAClE,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAA;IACpD,MAAM,MAAM,GAAG,uBAAuB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAA;IACtE,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IACxB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AACtE,CAAC;AAED,wGAAwG;AACxG,MAAM,UAAU,cAAc,CAAC,KAAc;IAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAA;AACpF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc;IACjD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,uBAAuB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAA;AAC5F,CAAC"}
@@ -0,0 +1,184 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * US ZIP (Zone Improvement Plan) codes: branded string types, the shape patterns, the first-digit →
7
+ * state geographic prior, and a state-plus-ZIP plucker.
8
+ *
9
+ * Salvaged 2026-06-03 from `isp-nexus/universe@6eeb7bd99643a6d62a8b8abbd50968a1e492b90b`
10
+ * `mailwoman/postal/zipcode.ts` (originally copyright Sister Software; both projects are
11
+ * AGPL-3.0). The only adaptation: the state abbreviation type comes from this package's own
12
+ * {@link state.js} rather than `@isp.nexus/tiger`, so the codex stays dependency-free.
13
+ */
14
+ import type { Tagged } from "type-fest";
15
+ import { type UsStateAbbreviation } from "./state.js";
16
+ /**
17
+ * USPS-recognized ZIP code digits.
18
+ *
19
+ * @internal
20
+ */
21
+ export type ZipCodeDigit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
22
+ /**
23
+ * A ZIP (Zone Improvement Plan) Code is a five-digit code assigned by the USPS to a section of a
24
+ * street, a collection of streets, an establishment, structure, or group of post office boxes, for
25
+ * the delivery of mail.
26
+ *
27
+ * - The first 3 digits of the ZIP code represent a specific central mail processing facility, which
28
+ * can be used to identify the locality and region of the address, i.e. the city and state.
29
+ * - The last 2 digits of the ZIP code represent a specific post office or delivery area.
30
+ *
31
+ * ```txt
32
+ * 90210
33
+ * / |⎿__(Post Office)
34
+ * / \
35
+ * (State) \
36
+ * \
37
+ * (City)
38
+ * ```
39
+ *
40
+ * Note that ZIP codes are not truly areas, but rather a group of deliverable addresses, which can
41
+ * and do change over time.
42
+ *
43
+ * @category Delivery
44
+ * @category Postal
45
+ * @type string
46
+ * @see {@linkcode ZipCodePlusFour} for the extended ZIP code format.
47
+ * @title ZIP Code
48
+ * @pattern ^\d{5}$
49
+ */
50
+ export type ZipCode = Tagged<string, "ZipCode">;
51
+ /**
52
+ * The extended ZIP code format includes the five-digit ZIP code followed by a hyphen and four
53
+ * additional digits. This extended format is used to provide more precise location information.
54
+ *
55
+ * - The first 3 digits of the ZIP code represent a specific central mail processing facility,
56
+ * - The last 2 digits of the ZIP code represent a specific post office or delivery area.
57
+ * - The four additional digits represent a specific delivery route within the ZIP code area.
58
+ *
59
+ * ```txt
60
+ * 90210-1234
61
+ * \_/\ /\__/
62
+ * / | \
63
+ * (State, City)_ / | \_ (Delivery Route)
64
+ * |
65
+ * (Post Office)
66
+ * ```
67
+ *
68
+ * Note that ZIP codes are not truly areas, but rather a group of deliverable addresses, which can
69
+ * and do change over time.
70
+ *
71
+ * @category Delivery
72
+ * @category Postal
73
+ * @type string
74
+ * @see {@linkcode ZipCode} for the standard ZIP code format.
75
+ * @title ZIP Code+4
76
+ * @pattern ^\d{5}-\d{4}$
77
+ */
78
+ export type ZipCodePlusFour = Tagged<string, "ZipCodePlusFour">;
79
+ /**
80
+ * Type utility to extract the state abbreviation from a ZIP code.
81
+ *
82
+ * @internal
83
+ */
84
+ export type ExtractStateFromZipCode<Zip extends ZipCode | ZipCodePlusFour> = Zip extends `${infer StateCode}${infer _Rest}` ? StateCode : never;
85
+ /**
86
+ * Record of US state abbreviations to their corresponding ZIP code prefix (the leading digit). A
87
+ * cheap geographic prior: a 5-digit code's first digit narrows it to a band of states, which the
88
+ * parser can weigh against the surrounding city/state tokens.
89
+ *
90
+ * @see {@linkcode ZipCodePrefixAbbreviationMap} for the reverse mapping.
91
+ * @internal
92
+ */
93
+ export declare const StateAbbreviationZipCodePrefixRecord: {
94
+ readonly AL: 3;
95
+ readonly AK: 9;
96
+ readonly AZ: 8;
97
+ readonly AR: 7;
98
+ readonly CA: 9;
99
+ readonly CO: 8;
100
+ readonly CT: 0;
101
+ readonly DE: 1;
102
+ readonly DC: 2;
103
+ readonly FL: 3;
104
+ readonly GA: 3;
105
+ readonly HI: 9;
106
+ readonly ID: 8;
107
+ readonly IL: 6;
108
+ readonly IN: 4;
109
+ readonly IA: 5;
110
+ readonly KS: 6;
111
+ readonly KY: 4;
112
+ readonly LA: 7;
113
+ readonly ME: 0;
114
+ readonly MD: 2;
115
+ readonly MA: 0;
116
+ readonly MI: 4;
117
+ readonly MN: 5;
118
+ readonly MS: 3;
119
+ readonly MO: 6;
120
+ readonly MT: 5;
121
+ readonly NE: 6;
122
+ readonly NV: 8;
123
+ readonly NH: 0;
124
+ readonly NJ: 0;
125
+ readonly NM: 8;
126
+ readonly NY: 1;
127
+ readonly NC: 2;
128
+ readonly ND: 5;
129
+ readonly OH: 4;
130
+ readonly OK: 7;
131
+ readonly OR: 9;
132
+ readonly PA: 1;
133
+ readonly RI: 0;
134
+ readonly SC: 2;
135
+ readonly SD: 5;
136
+ readonly TN: 3;
137
+ readonly TX: 7;
138
+ readonly UT: 8;
139
+ readonly VT: 0;
140
+ readonly VA: 2;
141
+ readonly WA: 9;
142
+ readonly WV: 2;
143
+ readonly WI: 5;
144
+ readonly WY: 8;
145
+ readonly PR: 0;
146
+ readonly GU: 9;
147
+ readonly VI: 0;
148
+ readonly MP: 9;
149
+ readonly AS: 9;
150
+ };
151
+ /**
152
+ * Map of ZIP code prefixes to their corresponding US state abbreviations.
153
+ */
154
+ declare const ZipCodePrefixAbbreviationMap: Map<ZipCodeDigit, ("AL" | "AK" | "AZ" | "AR" | "CA" | "CO" | "CT" | "DE" | "DC" | "FL" | "GA" | "HI" | "ID" | "IL" | "IN" | "IA" | "KS" | "KY" | "LA" | "ME" | "MD" | "MA" | "MI" | "MN" | "MS" | "MO" | "MT" | "NE" | "NV" | "NH" | "NJ" | "NM" | "NY" | "NC" | "ND" | "OH" | "OK" | "OR" | "PA" | "RI" | "SC" | "SD" | "TN" | "TX" | "UT" | "VT" | "VA" | "WA" | "WV" | "WI" | "WY" | "PR" | "GU" | "VI" | "MP" | "AS")[]>;
155
+ export { ZipCodePrefixAbbreviationMap };
156
+ /**
157
+ * Regex patterns for ZIP codes.
158
+ */
159
+ export declare const ZipCodePatterns: {
160
+ /**
161
+ * 5-digit, or 9-digit ZIP code or ZIP+4 code.
162
+ */
163
+ readonly Standard: RegExp;
164
+ /**
165
+ * Two-letter state abbreviation followed by a 5-digit ZIP code or ZIP+4 code.
166
+ */
167
+ readonly StateAbbreviationWithZipCode: RegExp;
168
+ };
169
+ /**
170
+ * Type-predicate to determine if a value is a valid ZIP code.
171
+ */
172
+ export declare function isZipCode(input: unknown): input is ZipCode | ZipCodePlusFour;
173
+ export interface PluckedStateZIPCodeResult {
174
+ stateAbbreviation: UsStateAbbreviation | null;
175
+ zipCode: ZipCode | ZipCodePlusFour;
176
+ }
177
+ /**
178
+ * Given an address string like `"NY"`, `"CA 94016"`, attempts to match the state abbreviation and
179
+ * postal code, if applicable.
180
+ *
181
+ * @see {@linkcode isUsStateAbbreviation} to validate the state abbreviation.
182
+ */
183
+ export declare function pluckStateZIPCode(input: unknown): PluckedStateZIPCodeResult | null;
184
+ //# sourceMappingURL=zipcode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zipcode.d.ts","sourceRoot":"","sources":["../../us/zipcode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAyB,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAE5E;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;AAE/D;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,CAAC,GAAG,SAAS,OAAO,GAAG,eAAe,IACxE,GAAG,SAAS,GAAG,MAAM,SAAS,GAAG,MAAM,KAAK,EAAE,GAAG,SAAS,GAAG,KAAK,CAAA;AAEnE;;;;;;;GAOG;AACH,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDa,CAAA;AAE9D;;GAEG;AACH,QAAA,MAAM,4BAA4B,8ZAAiD,CAAA;AAUnF,OAAO,EAAE,4BAA4B,EAAE,CAAA;AAEvC;;GAEG;AACH,eAAO,MAAM,eAAe;IAC3B;;OAEG;;IAGH;;OAEG;;CAEM,CAAA;AAEV;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,GAAG,eAAe,CAE5E;AAED,MAAM,WAAW,yBAAyB;IACzC,iBAAiB,EAAE,mBAAmB,GAAG,IAAI,CAAA;IAC7C,OAAO,EAAE,OAAO,GAAG,eAAe,CAAA;CAClC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,yBAAyB,GAAG,IAAI,CAalF"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * US ZIP (Zone Improvement Plan) codes: branded string types, the shape patterns, the first-digit →
7
+ * state geographic prior, and a state-plus-ZIP plucker.
8
+ *
9
+ * Salvaged 2026-06-03 from `isp-nexus/universe@6eeb7bd99643a6d62a8b8abbd50968a1e492b90b`
10
+ * `mailwoman/postal/zipcode.ts` (originally copyright Sister Software; both projects are
11
+ * AGPL-3.0). The only adaptation: the state abbreviation type comes from this package's own
12
+ * {@link state.js} rather than `@isp.nexus/tiger`, so the codex stays dependency-free.
13
+ */
14
+ import { isUsStateAbbreviation } from "./state.js";
15
+ /**
16
+ * Record of US state abbreviations to their corresponding ZIP code prefix (the leading digit). A
17
+ * cheap geographic prior: a 5-digit code's first digit narrows it to a band of states, which the
18
+ * parser can weigh against the surrounding city/state tokens.
19
+ *
20
+ * @see {@linkcode ZipCodePrefixAbbreviationMap} for the reverse mapping.
21
+ * @internal
22
+ */
23
+ export const StateAbbreviationZipCodePrefixRecord = {
24
+ AL: 3,
25
+ AK: 9,
26
+ AZ: 8,
27
+ AR: 7,
28
+ CA: 9,
29
+ CO: 8,
30
+ CT: 0,
31
+ DE: 1,
32
+ DC: 2,
33
+ FL: 3,
34
+ GA: 3,
35
+ HI: 9,
36
+ ID: 8,
37
+ IL: 6,
38
+ IN: 4,
39
+ IA: 5,
40
+ KS: 6,
41
+ KY: 4,
42
+ LA: 7,
43
+ ME: 0,
44
+ MD: 2,
45
+ MA: 0,
46
+ MI: 4,
47
+ MN: 5,
48
+ MS: 3,
49
+ MO: 6,
50
+ MT: 5,
51
+ NE: 6,
52
+ NV: 8,
53
+ NH: 0,
54
+ NJ: 0,
55
+ NM: 8,
56
+ NY: 1,
57
+ NC: 2,
58
+ ND: 5,
59
+ OH: 4,
60
+ OK: 7,
61
+ OR: 9,
62
+ PA: 1,
63
+ RI: 0,
64
+ SC: 2,
65
+ SD: 5,
66
+ TN: 3,
67
+ TX: 7,
68
+ UT: 8,
69
+ VT: 0,
70
+ VA: 2,
71
+ WA: 9,
72
+ WV: 2,
73
+ WI: 5,
74
+ WY: 8,
75
+ PR: 0,
76
+ GU: 9,
77
+ VI: 0,
78
+ MP: 9,
79
+ AS: 9,
80
+ };
81
+ /**
82
+ * Map of ZIP code prefixes to their corresponding US state abbreviations.
83
+ */
84
+ const ZipCodePrefixAbbreviationMap = new Map();
85
+ for (const [state, prefix] of Object.entries(StateAbbreviationZipCodePrefixRecord)) {
86
+ const states = ZipCodePrefixAbbreviationMap.get(prefix) ?? [];
87
+ ZipCodePrefixAbbreviationMap.set(prefix, [...states, state]);
88
+ }
89
+ export { ZipCodePrefixAbbreviationMap };
90
+ /**
91
+ * Regex patterns for ZIP codes.
92
+ */
93
+ export const ZipCodePatterns = {
94
+ /**
95
+ * 5-digit, or 9-digit ZIP code or ZIP+4 code.
96
+ */
97
+ Standard: /^\d{5}(?:[-\s]\d{4})?$/,
98
+ /**
99
+ * Two-letter state abbreviation followed by a 5-digit ZIP code or ZIP+4 code.
100
+ */
101
+ StateAbbreviationWithZipCode: /^(?:([A-Za-z]{2})[ ,]*)?([0-9]{5}(?:[-\s][0-9]{4})?)$/,
102
+ };
103
+ /**
104
+ * Type-predicate to determine if a value is a valid ZIP code.
105
+ */
106
+ export function isZipCode(input) {
107
+ return typeof input === "string" && ZipCodePatterns.Standard.test(input);
108
+ }
109
+ /**
110
+ * Given an address string like `"NY"`, `"CA 94016"`, attempts to match the state abbreviation and
111
+ * postal code, if applicable.
112
+ *
113
+ * @see {@linkcode isUsStateAbbreviation} to validate the state abbreviation.
114
+ */
115
+ export function pluckStateZIPCode(input) {
116
+ if (!input || typeof input !== "string")
117
+ return null;
118
+ const [, stateAbbreviation, zipCode = null] = input.match(ZipCodePatterns.StateAbbreviationWithZipCode) || [];
119
+ if (!zipCode)
120
+ return null;
121
+ const normalizedState = stateAbbreviation?.toUpperCase();
122
+ return {
123
+ stateAbbreviation: isUsStateAbbreviation(normalizedState) ? normalizedState : null,
124
+ zipCode: zipCode,
125
+ };
126
+ }
127
+ //# sourceMappingURL=zipcode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zipcode.js","sourceRoot":"","sources":["../../us/zipcode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,qBAAqB,EAA4B,MAAM,YAAY,CAAA;AA4E5E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG;IACnD,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;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