@mailwoman/codex 8.0.0 → 8.2.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.
- package/address-system-conventions.ts +7 -1
- package/au/delivery-service.ts +34 -12
- package/au/level-designator.ts +38 -14
- package/au/postcode.ts +9 -3
- package/au/state.ts +9 -3
- package/ca/postal-code.ts +10 -3
- package/ca/province.ts +23 -9
- package/ca/street-type.ts +9 -5
- package/country/country.ts +14 -8
- package/country/official-languages.ts +12 -4
- package/country/reference-data.ts +7 -3
- package/country/reference.ts +1 -1
- package/country/subdivision.ts +19 -8
- package/de/bundesland.ts +19 -6
- package/de/postleitzahl.ts +21 -7
- package/de/street-type.ts +14 -3
- package/fr/cedex.ts +15 -5
- package/fr/code-postal.ts +17 -4
- package/fr/departement.ts +18 -6
- package/fr/region.ts +23 -9
- package/fr/voie.ts +8 -4
- package/gb/country.ts +25 -9
- package/gb/postcode-area.ts +6 -2
- package/gb/postcode.ts +10 -3
- package/gb/street-type.ts +4 -2
- package/index.ts +1 -0
- package/jp/address-unit.ts +8 -4
- package/jp/postal-code.ts +7 -3
- package/jp/prefecture.ts +27 -10
- package/level-semantics.ts +55 -19
- package/nz/delivery-service.ts +43 -15
- package/nz/postcode.ts +9 -3
- package/out/address-system-conventions.d.ts +7 -1
- package/out/address-system-conventions.d.ts.map +1 -1
- package/out/address-system-conventions.js +7 -1
- package/out/address-system-conventions.js.map +1 -1
- package/out/au/delivery-service.d.ts +30 -10
- package/out/au/delivery-service.d.ts.map +1 -1
- package/out/au/delivery-service.js +7 -3
- package/out/au/delivery-service.js.map +1 -1
- package/out/au/level-designator.d.ts +27 -9
- package/out/au/level-designator.d.ts.map +1 -1
- package/out/au/level-designator.js +10 -6
- package/out/au/level-designator.js.map +1 -1
- package/out/au/postcode.d.ts +9 -3
- package/out/au/postcode.d.ts.map +1 -1
- package/out/au/postcode.js +9 -3
- package/out/au/postcode.js.map +1 -1
- package/out/au/state.d.ts +9 -3
- package/out/au/state.d.ts.map +1 -1
- package/out/au/state.js +6 -2
- package/out/au/state.js.map +1 -1
- package/out/ca/postal-code.d.ts +3 -1
- package/out/ca/postal-code.d.ts.map +1 -1
- package/out/ca/postal-code.js +9 -3
- package/out/ca/postal-code.js.map +1 -1
- package/out/ca/province.d.ts +18 -6
- package/out/ca/province.d.ts.map +1 -1
- package/out/ca/province.js +8 -4
- package/out/ca/province.js.map +1 -1
- package/out/ca/street-type.d.ts.map +1 -1
- package/out/ca/street-type.js +9 -5
- package/out/ca/street-type.js.map +1 -1
- package/out/country/country.d.ts +11 -7
- package/out/country/country.d.ts.map +1 -1
- package/out/country/country.js +7 -4
- package/out/country/country.js.map +1 -1
- package/out/country/official-languages.d.ts +12 -4
- package/out/country/official-languages.d.ts.map +1 -1
- package/out/country/official-languages.js +3 -1
- package/out/country/official-languages.js.map +1 -1
- package/out/country/reference-data.d.ts +6 -2
- package/out/country/reference-data.d.ts.map +1 -1
- package/out/country/reference-data.js +4 -2
- package/out/country/reference-data.js.map +1 -1
- package/out/country/reference.js +1 -1
- package/out/country/reference.js.map +1 -1
- package/out/country/subdivision.d.ts +12 -4
- package/out/country/subdivision.d.ts.map +1 -1
- package/out/country/subdivision.js +6 -4
- package/out/country/subdivision.js.map +1 -1
- package/out/de/bundesland.d.ts +18 -6
- package/out/de/bundesland.d.ts.map +1 -1
- package/out/de/bundesland.js +3 -1
- package/out/de/bundesland.js.map +1 -1
- package/out/de/postleitzahl.d.ts +21 -7
- package/out/de/postleitzahl.d.ts.map +1 -1
- package/out/de/postleitzahl.js +9 -3
- package/out/de/postleitzahl.js.map +1 -1
- package/out/de/street-type.d.ts +5 -4
- package/out/de/street-type.d.ts.map +1 -1
- package/out/de/street-type.js +10 -2
- package/out/de/street-type.js.map +1 -1
- package/out/fr/cedex.d.ts +15 -5
- package/out/fr/cedex.d.ts.map +1 -1
- package/out/fr/cedex.js +6 -2
- package/out/fr/cedex.js.map +1 -1
- package/out/fr/code-postal.d.ts +8 -11
- package/out/fr/code-postal.d.ts.map +1 -1
- package/out/fr/code-postal.js +24 -4
- package/out/fr/code-postal.js.map +1 -1
- package/out/fr/departement.d.ts +18 -6
- package/out/fr/departement.d.ts.map +1 -1
- package/out/fr/departement.js +3 -1
- package/out/fr/departement.js.map +1 -1
- package/out/fr/region.d.ts +18 -6
- package/out/fr/region.d.ts.map +1 -1
- package/out/fr/region.js +11 -5
- package/out/fr/region.js.map +1 -1
- package/out/fr/voie.d.ts +3 -1
- package/out/fr/voie.d.ts.map +1 -1
- package/out/fr/voie.js +3 -3
- package/out/fr/voie.js.map +1 -1
- package/out/gb/country.d.ts +18 -6
- package/out/gb/country.d.ts.map +1 -1
- package/out/gb/country.js +13 -5
- package/out/gb/country.js.map +1 -1
- package/out/gb/postcode-area.d.ts.map +1 -1
- package/out/gb/postcode-area.js +6 -2
- package/out/gb/postcode-area.js.map +1 -1
- package/out/gb/postcode.d.ts +3 -11
- package/out/gb/postcode.d.ts.map +1 -1
- package/out/gb/postcode.js +19 -3
- package/out/gb/postcode.js.map +1 -1
- package/out/gb/street-type.d.ts +3 -1
- package/out/gb/street-type.d.ts.map +1 -1
- package/out/gb/street-type.js +1 -1
- package/out/gb/street-type.js.map +1 -1
- package/out/index.d.ts.map +1 -1
- package/out/index.js.map +1 -1
- package/out/jp/address-unit.d.ts +6 -2
- package/out/jp/address-unit.d.ts.map +1 -1
- package/out/jp/address-unit.js +2 -2
- package/out/jp/address-unit.js.map +1 -1
- package/out/jp/postal-code.d.ts +6 -2
- package/out/jp/postal-code.d.ts.map +1 -1
- package/out/jp/postal-code.js +7 -3
- package/out/jp/postal-code.js.map +1 -1
- package/out/jp/prefecture.d.ts +24 -8
- package/out/jp/prefecture.d.ts.map +1 -1
- package/out/jp/prefecture.js +5 -3
- package/out/jp/prefecture.js.map +1 -1
- package/out/level-semantics.d.ts +48 -16
- package/out/level-semantics.d.ts.map +1 -1
- package/out/level-semantics.js +34 -12
- package/out/level-semantics.js.map +1 -1
- package/out/nz/delivery-service.d.ts +39 -13
- package/out/nz/delivery-service.d.ts.map +1 -1
- package/out/nz/delivery-service.js +16 -6
- package/out/nz/delivery-service.js.map +1 -1
- package/out/nz/postcode.d.ts +9 -3
- package/out/nz/postcode.d.ts.map +1 -1
- package/out/nz/postcode.js +9 -3
- package/out/nz/postcode.js.map +1 -1
- package/out/postcode-systems.d.ts +3 -1
- package/out/postcode-systems.d.ts.map +1 -1
- package/out/postcode-systems.js +1 -1
- package/out/postcode-systems.js.map +1 -1
- package/out/tools/build-country-surface-lexicon.js +26 -12
- package/out/tools/build-country-surface-lexicon.js.map +1 -1
- package/out/tools/export-country-surfaces.js.map +1 -1
- package/out/tools/generate-country-reference.d.ts +12 -4
- package/out/tools/generate-country-reference.d.ts.map +1 -1
- package/out/tools/generate-country-reference.js +10 -8
- package/out/tools/generate-country-reference.js.map +1 -1
- package/out/tools/generate-official-languages.d.ts +18 -6
- package/out/tools/generate-official-languages.d.ts.map +1 -1
- package/out/tools/generate-official-languages.js +9 -7
- package/out/tools/generate-official-languages.js.map +1 -1
- package/out/us/floor-designator.d.ts +15 -5
- package/out/us/floor-designator.d.ts.map +1 -1
- package/out/us/floor-designator.js +3 -1
- package/out/us/floor-designator.js.map +1 -1
- package/out/us/military-address.d.ts +36 -12
- package/out/us/military-address.d.ts.map +1 -1
- package/out/us/military-address.js +26 -15
- package/out/us/military-address.js.map +1 -1
- package/out/us/po-box.d.ts +9 -3
- package/out/us/po-box.d.ts.map +1 -1
- package/out/us/po-box.js +4 -2
- package/out/us/po-box.js.map +1 -1
- package/out/us/state.d.ts +6 -2
- package/out/us/state.d.ts.map +1 -1
- package/out/us/state.js +3 -1
- package/out/us/state.js.map +1 -1
- package/out/us/street-directional.d.ts +12 -3
- package/out/us/street-directional.d.ts.map +1 -1
- package/out/us/street-directional.js +8 -3
- package/out/us/street-directional.js.map +1 -1
- package/out/us/street-suffix.d.ts +24 -8
- package/out/us/street-suffix.d.ts.map +1 -1
- package/out/us/street-suffix.js +7 -3
- package/out/us/street-suffix.js.map +1 -1
- package/out/us/unit-designator.d.ts +24 -8
- package/out/us/unit-designator.d.ts.map +1 -1
- package/out/us/unit-designator.js +3 -1
- package/out/us/unit-designator.js.map +1 -1
- package/package.json +2 -2
- package/postcode-systems.ts +4 -2
- package/tools/build-country-surface-lexicon.ts +30 -12
- package/tools/export-country-surfaces.ts +2 -0
- package/tools/generate-country-reference.ts +27 -13
- package/tools/generate-official-languages.ts +27 -12
- package/us/floor-designator.ts +15 -5
- package/us/military-address.ts +53 -24
- package/us/po-box.ts +13 -5
- package/us/state.ts +6 -2
- package/us/street-directional.ts +14 -5
- package/us/street-suffix.ts +27 -9
- package/us/unit-designator.ts +25 -8
|
@@ -33,11 +33,17 @@
|
|
|
33
33
|
* PENTHOUSE and LOBBY may stand alone.
|
|
34
34
|
*/
|
|
35
35
|
export interface USFloorDesignator {
|
|
36
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Full canonical designator (uppercase per the publication).
|
|
38
|
+
*/
|
|
37
39
|
name: string;
|
|
38
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Approved USPS abbreviation (what the post office prints on standardized mail).
|
|
42
|
+
*/
|
|
39
43
|
abbreviation: string;
|
|
40
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Additional recognized surface variants from Appendix C2.
|
|
46
|
+
*/
|
|
41
47
|
variants: readonly string[];
|
|
42
48
|
/**
|
|
43
49
|
* True when Appendix C2 marks this designator as "Requires a Secondary Number" (FLOOR, BASEMENT). False for
|
|
@@ -70,7 +76,9 @@ export declare const US_FLOOR_DESIGNATORS: readonly [{
|
|
|
70
76
|
readonly variants: readonly [];
|
|
71
77
|
readonly requiresNumber: false;
|
|
72
78
|
}];
|
|
73
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* A canonical USPS floor-class designator name.
|
|
81
|
+
*/
|
|
74
82
|
export type USFloorDesignatorName = (typeof US_FLOOR_DESIGNATORS)[number]["name"];
|
|
75
83
|
/**
|
|
76
84
|
* Inverse lookup: every surface form (canonical name, approved abbreviation, or Appendix C2 variant) → its canonical
|
|
@@ -83,7 +91,9 @@ export declare const US_FLOOR_DESIGNATOR_LOOKUP: ReadonlyMap<string, USFloorDesi
|
|
|
83
91
|
* with when wiring the US codex slice. Includes canonical names, approved abbreviations, and Appendix C2 variants.
|
|
84
92
|
*/
|
|
85
93
|
export declare const US_FLOOR_DESIGNATOR_TOKENS: ReadonlySet<string>;
|
|
86
|
-
/**
|
|
94
|
+
/**
|
|
95
|
+
* Approved USPS abbreviation per canonical floor designator name.
|
|
96
|
+
*/
|
|
87
97
|
export declare const US_FLOOR_DESIGNATOR_PREFERRED_ABBR: Readonly<Record<USFloorDesignatorName, string>>;
|
|
88
98
|
/**
|
|
89
99
|
* Look up a USPS floor-class designator (by canonical name, abbreviation, or any Appendix C2 variant) and return the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floor-designator.d.ts","sourceRoot":"","sources":["../../us/floor-designator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IACjC
|
|
1
|
+
{"version":3,"file":"floor-designator.d.ts","sourceRoot":"","sources":["../../us/floor-designator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3B;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAA;CACvB;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;EAKgB,CAAA;AAEjD;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAA;AAEjF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,WAAW,CAAC,MAAM,EAAE,qBAAqB,CAe9E,CAAA;AAEJ;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,WAAW,CAAC,MAAM,CAA8C,CAAA;AAEzG;;GAEG;AACH,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CAAC,MAAM,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAE3C,CAAA;AAEpD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG;IACxE,UAAU,EAAE,qBAAqB,CAAA;IACjC,YAAY,EAAE,MAAM,CAAA;CACpB,GAAG,IAAI,CAOP;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE9D"}
|
|
@@ -59,7 +59,9 @@ export const US_FLOOR_DESIGNATOR_LOOKUP = (() => {
|
|
|
59
59
|
* with when wiring the US codex slice. Includes canonical names, approved abbreviations, and Appendix C2 variants.
|
|
60
60
|
*/
|
|
61
61
|
export const US_FLOOR_DESIGNATOR_TOKENS = new Set(US_FLOOR_DESIGNATOR_LOOKUP.keys());
|
|
62
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* Approved USPS abbreviation per canonical floor designator name.
|
|
64
|
+
*/
|
|
63
65
|
export const US_FLOOR_DESIGNATOR_PREFERRED_ABBR = Object.fromEntries(US_FLOOR_DESIGNATORS.map((r) => [r.name, r.abbreviation]));
|
|
64
66
|
/**
|
|
65
67
|
* Look up a USPS floor-class designator (by canonical name, abbreviation, or any Appendix C2 variant) and return the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floor-designator.js","sourceRoot":"","sources":["../../us/floor-designator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;
|
|
1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G,CAAC,IAAI,CAAC,CAAA;YACnC,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,GAAG,CAAA;AACX,CAAC,CAAC,EAAE,CAAA;AAEJ;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAwB,IAAI,GAAG,CAAC,0BAA0B,CAAC,IAAI,EAAE,CAAC,CAAA;AAEzG;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAoD,MAAM,CAAC,WAAW,CACpH,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CACN,CAAA;AAEpD;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAgC;IAIrE,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAA;IACpD,MAAM,UAAU,GAAG,0BAA0B,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAA;IAE7E,IAAI,CAAC,UAAU;QAAE,OAAO,IAAI,CAAA;IAE5B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,kCAAkC,CAAC,UAAU,CAAC,EAAE,CAAA;AACpF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACpD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,0BAA0B,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAA;AAC/F,CAAC"}
|
|
@@ -32,7 +32,9 @@
|
|
|
32
32
|
* @see {@link https://pe.usps.com/text/pub28/28c7_001.htm USPS Pub 28 Chapter 7 — Military Addresses}
|
|
33
33
|
* @see {@link https://pe.usps.com/text/pub28/28apb_001.htm USPS Pub 28 Appendix B — Armed Forces Addresses}
|
|
34
34
|
*/
|
|
35
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* USPS military / diplomatic post-office location codes (the "city" substitute on the city line).
|
|
37
|
+
*/
|
|
36
38
|
export declare const US_MILITARY_POST_OFFICE_CODES: readonly [{
|
|
37
39
|
readonly code: "APO";
|
|
38
40
|
readonly name: "Army Post Office";
|
|
@@ -95,15 +97,25 @@ export declare const US_MILITARY_UNIT_DESIGNATORS: readonly [{
|
|
|
95
97
|
readonly description: "Numbered military unit (battalion/company); format: UNIT <id> [BOX <box>]";
|
|
96
98
|
}];
|
|
97
99
|
export type USMilitaryUnitDesignatorCode = (typeof US_MILITARY_UNIT_DESIGNATORS)[number]["code"];
|
|
98
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* Result of a military address line parse (the unit line: PSC/CMR/UNIT).
|
|
102
|
+
*/
|
|
99
103
|
export interface USMilitaryUnitMatch {
|
|
100
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* The designator as it appeared ("PSC", "CMR", "Unit").
|
|
106
|
+
*/
|
|
101
107
|
matched: string;
|
|
102
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* The canonical designator code ("PSC", "CMR", "UNIT").
|
|
110
|
+
*/
|
|
103
111
|
code: USMilitaryUnitDesignatorCode;
|
|
104
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* The installation identifier ("1520", "453").
|
|
114
|
+
*/
|
|
105
115
|
id: string;
|
|
106
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* The box number when present ("4620", "1234A").
|
|
118
|
+
*/
|
|
107
119
|
box?: string;
|
|
108
120
|
}
|
|
109
121
|
/**
|
|
@@ -112,15 +124,25 @@ export interface USMilitaryUnitMatch {
|
|
|
112
124
|
* BOX component (per Appendix B, BOX is required for PSC/CMR; a bare "PSC 1520" is malformed).
|
|
113
125
|
*/
|
|
114
126
|
export declare function matchMilitaryUnitLine(input: unknown): USMilitaryUnitMatch | null;
|
|
115
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* Type-predicate: does the input look like a USPS military unit line (PSC/CMR/UNIT)?
|
|
129
|
+
*/
|
|
116
130
|
export declare function isMilitaryUnitLine(input: unknown): boolean;
|
|
117
|
-
/**
|
|
131
|
+
/**
|
|
132
|
+
* Result of a military city-line parse (APO/FPO/DPO + region code + ZIP).
|
|
133
|
+
*/
|
|
118
134
|
export interface USMilitaryCityMatch {
|
|
119
|
-
/**
|
|
135
|
+
/**
|
|
136
|
+
* The post-office code as it appeared ("APO", "FPO", "DPO").
|
|
137
|
+
*/
|
|
120
138
|
matched: string;
|
|
121
|
-
/**
|
|
139
|
+
/**
|
|
140
|
+
* The canonical post-office code.
|
|
141
|
+
*/
|
|
122
142
|
code: USMilitaryPostOfficeCode;
|
|
123
|
-
/**
|
|
143
|
+
/**
|
|
144
|
+
* The Armed Forces region code ("AA", "AE", "AP").
|
|
145
|
+
*/
|
|
124
146
|
region: USArmedForcesRegionCode;
|
|
125
147
|
/**
|
|
126
148
|
* The 5-digit or 9-digit ZIP code. Typical ranges per Pub 28: 09xxx (AE), 34xxx (AA), 96xxx (AP) — range validation
|
|
@@ -137,6 +159,8 @@ export interface USMilitaryCityMatch {
|
|
|
137
159
|
* code.
|
|
138
160
|
*/
|
|
139
161
|
export declare function matchMilitaryCityLine(input: unknown): USMilitaryCityMatch | null;
|
|
140
|
-
/**
|
|
162
|
+
/**
|
|
163
|
+
* Type-predicate: does the input look like a USPS military city line (APO/FPO/DPO + region + ZIP)?
|
|
164
|
+
*/
|
|
141
165
|
export declare function isMilitaryCityLine(input: unknown): boolean;
|
|
142
166
|
//# sourceMappingURL=military-address.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"military-address.d.ts","sourceRoot":"","sources":["../../us/military-address.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH
|
|
1
|
+
{"version":3,"file":"military-address.d.ts","sourceRoot":"","sources":["../../us/military-address.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;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AAG,IAAI,CAYhF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE1D"}
|
|
@@ -32,16 +32,22 @@
|
|
|
32
32
|
* @see {@link https://pe.usps.com/text/pub28/28c7_001.htm USPS Pub 28 Chapter 7 — Military Addresses}
|
|
33
33
|
* @see {@link https://pe.usps.com/text/pub28/28apb_001.htm USPS Pub 28 Appendix B — Armed Forces Addresses}
|
|
34
34
|
*/
|
|
35
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* USPS military / diplomatic post-office location codes (the "city" substitute on the city line).
|
|
37
|
+
*/
|
|
36
38
|
export const US_MILITARY_POST_OFFICE_CODES = [
|
|
37
39
|
/**
|
|
38
40
|
* Army Post Office — domestic USPS gateway for Army and Air Force overseas mail; also used for some diplomatic
|
|
39
41
|
* addresses (DPO is preferred for State Dept posts since 2011).
|
|
40
42
|
*/
|
|
41
43
|
{ code: "APO", name: "Army Post Office", armedForces: true },
|
|
42
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Fleet Post Office — Navy ships and shore installations.
|
|
46
|
+
*/
|
|
43
47
|
{ code: "FPO", name: "Fleet Post Office", armedForces: true },
|
|
44
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Diplomatic Post Office — US embassies and missions (added 2011).
|
|
50
|
+
*/
|
|
45
51
|
{ code: "DPO", name: "Diplomatic Post Office", armedForces: false },
|
|
46
52
|
];
|
|
47
53
|
/**
|
|
@@ -86,8 +92,10 @@ export const US_MILITARY_UNIT_DESIGNATORS = [
|
|
|
86
92
|
description: "Numbered military unit (battalion/company); format: UNIT <id> [BOX <box>]",
|
|
87
93
|
},
|
|
88
94
|
];
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Unit-line regex: PSC/CMR/UNIT <id> [BOX <box>] Identifiers are numeric; box numbers are alphanumeric. UNIT may stand
|
|
97
|
+
* without BOX.
|
|
98
|
+
*/
|
|
91
99
|
const UNIT_LINE_RE = /^\s*(psc|cmr|unit)\s+(\d+)(?:\s+box\s+([\dA-Za-z]+))?\s*$/i;
|
|
92
100
|
/**
|
|
93
101
|
* If `input` is a USPS military unit-line ("PSC 1520 BOX 4620", "CMR 453 BOX 100", "UNIT 7 BOX 234A", "UNIT 7"), return
|
|
@@ -109,7 +117,9 @@ export function matchMilitaryUnitLine(input) {
|
|
|
109
117
|
}
|
|
110
118
|
return { matched: m[1], code, id, ...(box ? { box } : {}) };
|
|
111
119
|
}
|
|
112
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* Type-predicate: does the input look like a USPS military unit line (PSC/CMR/UNIT)?
|
|
122
|
+
*/
|
|
113
123
|
export function isMilitaryUnitLine(input) {
|
|
114
124
|
try {
|
|
115
125
|
return matchMilitaryUnitLine(input) !== null;
|
|
@@ -118,14 +128,13 @@ export function isMilitaryUnitLine(input) {
|
|
|
118
128
|
return false; // PSC/CMR without BOX is structurally malformed (not a false negative)
|
|
119
129
|
}
|
|
120
130
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
// co-validation is operational policy, not structural syntax).
|
|
131
|
+
/**
|
|
132
|
+
* City-line regex: APO/FPO/DPO <region> <zip> USPS military ZIP assignment per Pub 28 and the Armed Forces zip code
|
|
133
|
+
* list: - AA (Americas): 340xx range - AE (Europe/ME/Africa/Canada): 09xxx range - AP (Pacific): 962xx-966xx range The
|
|
134
|
+
* regex accepts any 5-digit or 9-digit ZIP code in combination with a valid region code — validating the specific
|
|
135
|
+
* numeric range for each region is left to the caller (region+ZIP co-validation is operational policy, not structural
|
|
136
|
+
* syntax).
|
|
137
|
+
*/
|
|
129
138
|
const CITY_LINE_RE = /^\s*(apo|fpo|dpo)\s+(aa|ae|ap)\s+(\d{5}(?:-\d{4})?)\s*$/i;
|
|
130
139
|
/**
|
|
131
140
|
* If `input` is a USPS military city line ("APO AE 09165", "FPO AP 96602-1254", "DPO AE 09498", "APO AA 34022", "APO AP
|
|
@@ -148,7 +157,9 @@ export function matchMilitaryCityLine(input) {
|
|
|
148
157
|
zip: m[3],
|
|
149
158
|
};
|
|
150
159
|
}
|
|
151
|
-
/**
|
|
160
|
+
/**
|
|
161
|
+
* Type-predicate: does the input look like a USPS military city line (APO/FPO/DPO + region + ZIP)?
|
|
162
|
+
*/
|
|
152
163
|
export function isMilitaryCityLine(input) {
|
|
153
164
|
return matchMilitaryCityLine(input) !== null;
|
|
154
165
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"military-address.js","sourceRoot":"","sources":["../../us/military-address.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH
|
|
1
|
+
{"version":3,"file":"military-address.js","sourceRoot":"","sources":["../../us/military-address.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC5C;;;OAGG;IACH,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,WAAW,EAAE,IAAI,EAAE;IAC5D;;OAEG;IACH,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,mBAAmB,EAAE,WAAW,EAAE,IAAI,EAAE;IAC7D;;OAEG;IACH,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,wBAAwB,EAAE,WAAW,EAAE,KAAK,EAAE;CAC1D,CAAA;AAIV;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACtC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,uBAAuB,EAAE,WAAW,EAAE,6BAA6B,EAAE;IACzF,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,qBAAqB,EAAE,WAAW,EAAE,yCAAyC,EAAE;IACnG,EAAE,IAAI,EAAE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*/
|
|
26
26
|
export declare function isPOBox(input: unknown): boolean;
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Result of a PO-box parse: the matched designator phrase and the box identifier.
|
|
29
|
+
*/
|
|
28
30
|
export interface PoBoxMatch {
|
|
29
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* The designator phrase as it appeared, e.g. "P.O. Box", "Post Office Box".
|
|
33
|
+
*/
|
|
30
34
|
matched: string;
|
|
31
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* The box identifier, e.g. "123", "12-A".
|
|
37
|
+
*/
|
|
32
38
|
id: string;
|
|
33
39
|
}
|
|
34
40
|
/**
|
package/out/us/po-box.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"po-box.d.ts","sourceRoot":"","sources":["../../us/po-box.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,wGASI,CAAA;AAEtC,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"po-box.d.ts","sourceRoot":"","sources":["../../us/po-box.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,wGASI,CAAA;AAEtC,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAA;AAStE;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE/C;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;CACV;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAS5D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMpD"}
|
package/out/us/po-box.js
CHANGED
|
@@ -26,8 +26,10 @@ export const US_PO_BOX_DESIGNATORS = [
|
|
|
26
26
|
"LOCKBOX",
|
|
27
27
|
"BOX",
|
|
28
28
|
];
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Matches a leading PO-box designator + its identifier. Allows "P.O. Box", "PO BOX", "Post Office Box", "Box 12-A",
|
|
31
|
+
* etc. The id is alphanumeric with optional dashes (USPS caller/firm ids exist).
|
|
32
|
+
*/
|
|
31
33
|
const PO_BOX_RE = /^\s*(?:(p\.?\s*o\.?\s*box)|(post\s+office\s+box)|(firm\s+caller)|(caller)|(drawer)|(lockbox)|(box))\s*#?\s*([\dA-Za-z][\dA-Za-z-]*)\s*$/i;
|
|
32
34
|
/**
|
|
33
35
|
* Type-predicate: does the input look like a standalone PO Box address? Case-insensitive and tolerant of "P.O. Box",
|
package/out/us/po-box.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"po-box.js","sourceRoot":"","sources":["../../us/po-box.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACpC,iBAAiB;IACjB,QAAQ;IACR,SAAS;IACT,aAAa;IACb,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,KAAK;CACgC,CAAA;AAItC
|
|
1
|
+
{"version":3,"file":"po-box.js","sourceRoot":"","sources":["../../us/po-box.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACpC,iBAAiB;IACjB,QAAQ;IACR,SAAS;IACT,aAAa;IACb,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,KAAK;CACgC,CAAA;AAItC;;;GAGG;AACH,MAAM,SAAS,GACd,0IAA0I,CAAA;AAE3I;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAC1D,CAAC;AAgBD;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAA;IAC1C,MAAM,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAE/B,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAA;IACnB,MAAM,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;IACnF,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAE,CAAA;IAEhB,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA;AACvB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAa;IAC3C,MAAM,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;IAE3B,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAA;IAEpB,OAAO,UAAU,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE,EAAE,CAAA;AACtC,CAAC"}
|
package/out/us/state.d.ts
CHANGED
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
* Rico, Guam, US Virgin Islands, Northern Mariana Islands, American Samoa).
|
|
17
17
|
*/
|
|
18
18
|
export declare const US_STATE_ABBREVIATIONS: readonly ["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"];
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* A USPS two-letter state-or-territory abbreviation.
|
|
21
|
+
*/
|
|
20
22
|
export type USStateAbbreviation = (typeof US_STATE_ABBREVIATIONS)[number];
|
|
21
23
|
/**
|
|
22
24
|
* Type-predicate for a USPS state-or-territory abbreviation. Case-insensitive (`"ca"` and `"CA"` both pass), since the
|
|
@@ -86,6 +88,8 @@ export declare const US_STATE_BY_ABBREVIATION: {
|
|
|
86
88
|
readonly MP: "Northern Mariana Islands";
|
|
87
89
|
readonly AS: "American Samoa";
|
|
88
90
|
};
|
|
89
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* The full state/territory names, derived from {@link US_STATE_BY_ABBREVIATION}.
|
|
93
|
+
*/
|
|
90
94
|
export declare const US_STATE_NAMES: readonly string[];
|
|
91
95
|
//# sourceMappingURL=state.d.ts.map
|
package/out/us/state.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../us/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;GAGG;AACH,eAAO,MAAM,sBAAsB,2VAyDG,CAAA;AAEtC
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../us/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;GAGG;AACH,eAAO,MAAM,sBAAsB,2VAyDG,CAAA;AAEtC;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAA;AAIzE;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAElF;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDmB,CAAA;AAExD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAA4C,CAAA"}
|
package/out/us/state.js
CHANGED
|
@@ -144,6 +144,8 @@ export const US_STATE_BY_ABBREVIATION = {
|
|
|
144
144
|
MP: "Northern Mariana Islands",
|
|
145
145
|
AS: "American Samoa",
|
|
146
146
|
};
|
|
147
|
-
/**
|
|
147
|
+
/**
|
|
148
|
+
* The full state/territory names, derived from {@link US_STATE_BY_ABBREVIATION}.
|
|
149
|
+
*/
|
|
148
150
|
export const US_STATE_NAMES = Object.values(US_STATE_BY_ABBREVIATION);
|
|
149
151
|
//# sourceMappingURL=state.js.map
|
package/out/us/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../us/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACrC,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI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AE,EAAE,SAAS;IACb,EAAE,EAAE,UAAU;IACd,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,eAAe;IACnB,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,aAAa;IACjB,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,mBAAmB;IACvB,EAAE,EAAE,0BAA0B;IAC9B,EAAE,EAAE,gBAAgB;CACmC,CAAA;AAExD;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAsB,MAAM,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAA"}
|
|
@@ -24,9 +24,14 @@ export declare const DirectionalAbbreviation: {
|
|
|
24
24
|
readonly SOUTHWEST: "SW";
|
|
25
25
|
};
|
|
26
26
|
export type DirectionalAbbreviation = (typeof DirectionalAbbreviation)[keyof typeof DirectionalAbbreviation];
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* The 8 directional names accepted by the USPS (intercardinals spaced, per the publication).
|
|
29
|
+
*/
|
|
28
30
|
export declare const DirectionalNames: readonly ["NORTH", "EAST", "SOUTH", "WEST", "NORTH EAST", "NORTH WEST", "SOUTH EAST", "SOUTH WEST"];
|
|
29
31
|
export type DirectionalName = (typeof DirectionalNames)[number];
|
|
32
|
+
/**
|
|
33
|
+
* Surface forms a US directional can take (`N`, `N.`, `North`), for both parsing and formatting.
|
|
34
|
+
*/
|
|
30
35
|
export declare const DirectionalNameVariations: readonly ["NORTH", "EAST", "SOUTH", "WEST", "NORTH EAST", "NORTH WEST", "SOUTH EAST", "SOUTH WEST", "NORTHEAST", "NORTHWEST", "SOUTHEAST", "SOUTHWEST", "North", "East", "South", "West", "North East", "North West", "South East", "South West", "Northeast", "Northwest", "Southeast", "Southwest", "north east", "north west", "south east", "south west", "northeast", "northwest", "southeast", "southwest"];
|
|
31
36
|
export type DirectionalNameVariation = (typeof DirectionalNameVariations)[number];
|
|
32
37
|
/**
|
|
@@ -81,9 +86,13 @@ export declare function lookupDirectionalAbbreviation(input: unknown): Direction
|
|
|
81
86
|
* Result of a directional lookup: the canonical full name + its preferred abbreviation.
|
|
82
87
|
*/
|
|
83
88
|
export interface DirectionalMatch {
|
|
84
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* The matched directional name, e.g. "NORTH", "NORTH EAST".
|
|
91
|
+
*/
|
|
85
92
|
directional: DirectionalName;
|
|
86
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* The corresponding USPS abbreviation, e.g. "N", "NE".
|
|
95
|
+
*/
|
|
87
96
|
abbreviation: DirectionalAbbreviation;
|
|
88
97
|
}
|
|
89
98
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"street-directional.d.ts","sourceRoot":"","sources":["../../us/street-directional.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;CAS1B,CAAA;AAEV,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,OAAO,uBAAuB,CAAC,CAAA;AAE5G
|
|
1
|
+
{"version":3,"file":"street-directional.d.ts","sourceRoot":"","sources":["../../us/street-directional.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;CAS1B,CAAA;AAEV,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,OAAO,uBAAuB,CAAC,CAAA;AAE5G;;GAEG;AACH,eAAO,MAAM,gBAAgB,qGASS,CAAA;AAEtC,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE/D;;GAEG;AACH,eAAO,MAAM,yBAAyB,mZA6BA,CAAA;AAEtC,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEjF;;GAEG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KAAK,EAAE,OAAO,GAAG,OAAO,CAEhE"}
|
|
@@ -24,7 +24,9 @@ export const DirectionalAbbreviation = {
|
|
|
24
24
|
SOUTHEAST: "SE",
|
|
25
25
|
SOUTHWEST: "SW",
|
|
26
26
|
};
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* The 8 directional names accepted by the USPS (intercardinals spaced, per the publication).
|
|
29
|
+
*/
|
|
28
30
|
export const DirectionalNames = [
|
|
29
31
|
"NORTH",
|
|
30
32
|
"EAST",
|
|
@@ -35,6 +37,9 @@ export const DirectionalNames = [
|
|
|
35
37
|
"SOUTH EAST",
|
|
36
38
|
"SOUTH WEST",
|
|
37
39
|
];
|
|
40
|
+
/**
|
|
41
|
+
* Surface forms a US directional can take (`N`, `N.`, `North`), for both parsing and formatting.
|
|
42
|
+
*/
|
|
38
43
|
export const DirectionalNameVariations = [
|
|
39
44
|
...DirectionalNames,
|
|
40
45
|
// Without spaces (the common US street form: "Northeast Main St")…
|
|
@@ -118,7 +123,7 @@ export function lookupDirectionalAbbreviation(input) {
|
|
|
118
123
|
if (!input || typeof input !== "string")
|
|
119
124
|
return null;
|
|
120
125
|
return (DirectionalToAbbreviationMap.get(input) ||
|
|
121
|
-
DirectionalToAbbreviationMap.get(input.trim().toUpperCase().
|
|
126
|
+
DirectionalToAbbreviationMap.get(input.trim().toUpperCase().replaceAll(/\s+/g, " ")) ||
|
|
122
127
|
null);
|
|
123
128
|
}
|
|
124
129
|
/**
|
|
@@ -160,7 +165,7 @@ export function matchLeadingDirectional(street) {
|
|
|
160
165
|
* spaced "NORTH EAST".
|
|
161
166
|
*/
|
|
162
167
|
export function renderDirectional(match, form, reference) {
|
|
163
|
-
const target = form === "abbr" ? match.abbreviation : match.canonical.
|
|
168
|
+
const target = form === "abbr" ? match.abbreviation : match.canonical.replaceAll(/\s+/g, "");
|
|
164
169
|
return matchCase(target, reference);
|
|
165
170
|
}
|
|
166
171
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"street-directional.js","sourceRoot":"","sources":["../../us/street-directional.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACtC,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,GAAG;IACT,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,GAAG;IACT,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;CACN,CAAA;AAIV
|
|
1
|
+
{"version":3,"file":"street-directional.js","sourceRoot":"","sources":["../../us/street-directional.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACtC,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,GAAG;IACT,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,GAAG;IACT,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;CACN,CAAA;AAIV;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;CACyB,CAAA;AAItC;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACxC,GAAG,gBAAgB;IACnB,mEAAmE;IACnE,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;IACX,cAAc;IACd,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;IACX,c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AAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,CAAA;IACtC,MAAM,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAA;IAElC,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAA;IAEnB,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,WAAW,EAAE,YAAY,EAAE,CAAC,CAAC,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;AAClF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAChC,KAA4E,EAC5E,IAAqB,EACrB,SAAiB;IAEjB,MAAM,MAAM,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IAE5F,OAAO,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AACpC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACtD,OAAO,iBAAiB,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,CAAA;AACpF,CAAC"}
|
|
@@ -226,14 +226,18 @@ export declare const US_STREET_SUFFIX_VARIANTS: {
|
|
|
226
226
|
readonly WELL: readonly ["WL"];
|
|
227
227
|
readonly WELLS: readonly ["WLS"];
|
|
228
228
|
};
|
|
229
|
-
/**
|
|
229
|
+
/**
|
|
230
|
+
* Canonical USPS suffix (full word, uppercase per the publication).
|
|
231
|
+
*/
|
|
230
232
|
export type USStreetSuffix = keyof typeof US_STREET_SUFFIX_VARIANTS;
|
|
231
233
|
/**
|
|
232
234
|
* Inverse lookup: every variant abbreviation OR full canonical word → its canonical key. Built once at module load,
|
|
233
235
|
* lowercase-keyed for case-insensitive matching (`street` → `"STREET"`, `st` → `"STREET"`, `strt` → `"STREET"`, …).
|
|
234
236
|
*/
|
|
235
237
|
export declare const US_STREET_SUFFIX_LOOKUP: ReadonlyMap<string, USStreetSuffix>;
|
|
236
|
-
/**
|
|
238
|
+
/**
|
|
239
|
+
* Preferred USPS abbreviation per canonical (`AVENUE → "AVE"`, `STREET → "ST"`).
|
|
240
|
+
*/
|
|
237
241
|
export declare const US_STREET_SUFFIX_PREFERRED_ABBR: Readonly<Record<USStreetSuffix, string>>;
|
|
238
242
|
/**
|
|
239
243
|
* Apply `target`'s letters in the same case-pattern as `reference`. Three patterns covered:
|
|
@@ -466,15 +470,25 @@ export type StreetSuffixAbbreviationRecord = typeof US_STREET_SUFFIX_VARIANTS;
|
|
|
466
470
|
* A canonical USPS street suffix, i.e. "STREET", "AVENUE", "BOULEVARD". Aliases {@link USStreetSuffix}.
|
|
467
471
|
*/
|
|
468
472
|
export type StreetSuffix = USStreetSuffix;
|
|
469
|
-
/**
|
|
473
|
+
/**
|
|
474
|
+
* A standardized USPS street suffix abbreviation (the preferred form), i.e. "ST", "AVE", "BLVD".
|
|
475
|
+
*/
|
|
470
476
|
export type USPSStandardSuffixAbbreviation = StreetSuffixAbbreviationRecord[StreetSuffix][0];
|
|
471
|
-
/**
|
|
477
|
+
/**
|
|
478
|
+
* Any USPS-recognized suffix variant or abbreviation.
|
|
479
|
+
*/
|
|
472
480
|
export type StreetSuffixAbbreviation = StreetSuffixAbbreviationRecord[StreetSuffix][number];
|
|
473
|
-
/**
|
|
481
|
+
/**
|
|
482
|
+
* Result of a successful USPS street suffix lookup.
|
|
483
|
+
*/
|
|
474
484
|
export interface StreetSuffixMatch<S extends StreetSuffix = StreetSuffix> {
|
|
475
|
-
/**
|
|
485
|
+
/**
|
|
486
|
+
* The matched canonical USPS street suffix, i.e. "STREET", "AVENUE".
|
|
487
|
+
*/
|
|
476
488
|
suffix: S;
|
|
477
|
-
/**
|
|
489
|
+
/**
|
|
490
|
+
* The preferred USPS street suffix abbreviation, i.e. "ST", "AVE".
|
|
491
|
+
*/
|
|
478
492
|
abbreviation: StreetSuffixAbbreviationRecord[S][0];
|
|
479
493
|
}
|
|
480
494
|
/**
|
|
@@ -482,7 +496,9 @@ export interface StreetSuffixMatch<S extends StreetSuffix = StreetSuffix> {
|
|
|
482
496
|
*/
|
|
483
497
|
export declare function lookupStreetSuffix<S extends StreetSuffix>(suffix: S): StreetSuffixMatch<S>;
|
|
484
498
|
export declare function lookupStreetSuffix(input: string | null | undefined): StreetSuffixMatch | null;
|
|
485
|
-
/**
|
|
499
|
+
/**
|
|
500
|
+
* Type-predicate: is the input a canonical USPS street suffix (uppercase full word, e.g. "STREET")?
|
|
501
|
+
*/
|
|
486
502
|
export declare function isStreetSuffix(input: unknown): input is StreetSuffix;
|
|
487
503
|
/**
|
|
488
504
|
* True when a token is any USPS street suffix or abbreviation (case-insensitive) — `"St"`, `"BLVD"`, `"trail"`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"street-suffix.d.ts","sourceRoot":"","sources":["../../us/street-suffix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;GAGG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8MgB,CAAA;AAEtD
|
|
1
|
+
{"version":3,"file":"street-suffix.d.ts","sourceRoot":"","sources":["../../us/street-suffix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;GAGG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ACH,MAAM,MAAM,wBAAwB,GAAG,8BAA8B,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAE3F;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY;IACvE;;OAEG;IACH,MAAM,EAAE,CAAC,CAAA;IACT;;OAEG;IACH,YAAY,EAAE,8BAA8B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;CAClD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAA;AAC3F,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,iBAAiB,GAAG,IAAI,CAAA;AAW9F;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE3D"}
|
package/out/us/street-suffix.js
CHANGED
|
@@ -245,7 +245,9 @@ export const US_STREET_SUFFIX_LOOKUP = (() => {
|
|
|
245
245
|
}
|
|
246
246
|
return out;
|
|
247
247
|
})();
|
|
248
|
-
/**
|
|
248
|
+
/**
|
|
249
|
+
* Preferred USPS abbreviation per canonical (`AVENUE → "AVE"`, `STREET → "ST"`).
|
|
250
|
+
*/
|
|
249
251
|
export const US_STREET_SUFFIX_PREFERRED_ABBR = Object.fromEntries(Object.keys(US_STREET_SUFFIX_VARIANTS).map((k) => [k, US_STREET_SUFFIX_VARIANTS[k][0]]));
|
|
250
252
|
/**
|
|
251
253
|
* Apply `target`'s letters in the same case-pattern as `reference`. Three patterns covered:
|
|
@@ -272,7 +274,7 @@ export function matchTrailingSuffix(street) {
|
|
|
272
274
|
if (!trimmed)
|
|
273
275
|
return null;
|
|
274
276
|
const parts = trimmed.split(/\s+/);
|
|
275
|
-
const last = parts
|
|
277
|
+
const last = parts.at(-1);
|
|
276
278
|
const canonical = US_STREET_SUFFIX_LOOKUP.get(last.toLowerCase());
|
|
277
279
|
if (!canonical)
|
|
278
280
|
return null;
|
|
@@ -290,7 +292,9 @@ export function lookupStreetSuffix(input) {
|
|
|
290
292
|
return null;
|
|
291
293
|
return { suffix, abbreviation: US_STREET_SUFFIX_VARIANTS[suffix][0] };
|
|
292
294
|
}
|
|
293
|
-
/**
|
|
295
|
+
/**
|
|
296
|
+
* Type-predicate: is the input a canonical USPS street suffix (uppercase full word, e.g. "STREET")?
|
|
297
|
+
*/
|
|
294
298
|
export function isStreetSuffix(input) {
|
|
295
299
|
return typeof input === "string" && Object.hasOwn(US_STREET_SUFFIX_VARIANTS, input);
|
|
296
300
|
}
|