@mailwoman/codex 4.4.0 → 4.5.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/out/address-system-conventions.d.ts +2 -2
- package/out/address-system-conventions.js +4 -4
- package/out/au/delivery-service.d.ts +165 -0
- package/out/au/delivery-service.d.ts.map +1 -0
- package/out/au/delivery-service.js +132 -0
- package/out/au/delivery-service.js.map +1 -0
- package/out/au/index.d.ts +15 -0
- package/out/au/index.d.ts.map +1 -0
- package/out/au/index.js +15 -0
- package/out/au/index.js.map +1 -0
- package/out/au/level-designator.d.ts +150 -0
- package/out/au/level-designator.d.ts.map +1 -0
- package/out/au/level-designator.js +156 -0
- package/out/au/level-designator.js.map +1 -0
- package/out/au/postcode.d.ts +40 -0
- package/out/au/postcode.d.ts.map +1 -0
- package/out/au/postcode.js +37 -0
- package/out/au/postcode.js.map +1 -0
- package/out/au/state.d.ts +31 -0
- package/out/au/state.d.ts.map +1 -0
- package/out/au/state.js +31 -0
- package/out/au/state.js.map +1 -0
- package/out/country/country.d.ts +18 -17
- package/out/country/country.d.ts.map +1 -1
- package/out/country/country.js +17 -16
- package/out/country/country.js.map +1 -1
- package/out/country/index.d.ts +1 -1
- package/out/country/index.d.ts.map +1 -1
- package/out/country/index.js +1 -1
- package/out/country/index.js.map +1 -1
- package/out/country/names.d.ts +1 -1
- package/out/country/names.js +1 -1
- package/out/fr/cedex.d.ts +35 -0
- package/out/fr/cedex.d.ts.map +1 -0
- package/out/fr/cedex.js +43 -0
- package/out/fr/cedex.js.map +1 -0
- package/out/fr/index.d.ts +1 -0
- package/out/fr/index.d.ts.map +1 -1
- package/out/fr/index.js +1 -0
- package/out/fr/index.js.map +1 -1
- package/out/index.d.ts +3 -1
- package/out/index.d.ts.map +1 -1
- package/out/index.js +2 -0
- package/out/index.js.map +1 -1
- package/out/nz/delivery-service.d.ts +102 -0
- package/out/nz/delivery-service.d.ts.map +1 -0
- package/out/nz/delivery-service.js +110 -0
- package/out/nz/delivery-service.js.map +1 -0
- package/out/nz/index.d.ts +12 -0
- package/out/nz/index.d.ts.map +1 -0
- package/out/nz/index.js +12 -0
- package/out/nz/index.js.map +1 -0
- package/out/nz/postcode.d.ts +31 -0
- package/out/nz/postcode.d.ts.map +1 -0
- package/out/nz/postcode.js +28 -0
- package/out/nz/postcode.js.map +1 -0
- package/out/postcode-systems.d.ts +1 -1
- package/out/postcode-systems.d.ts.map +1 -1
- package/out/postcode-systems.js +4 -0
- package/out/postcode-systems.js.map +1 -1
- package/out/us/floor-designator.d.ts +104 -0
- package/out/us/floor-designator.d.ts.map +1 -0
- package/out/us/floor-designator.js +84 -0
- package/out/us/floor-designator.js.map +1 -0
- package/out/us/index.d.ts +6 -2
- package/out/us/index.d.ts.map +1 -1
- package/out/us/index.js +6 -2
- package/out/us/index.js.map +1 -1
- package/out/us/military-address.d.ts +143 -0
- package/out/us/military-address.d.ts.map +1 -0
- package/out/us/military-address.js +156 -0
- package/out/us/military-address.js.map +1 -0
- package/out/us/street-directional.d.ts +4 -2
- package/out/us/street-directional.d.ts.map +1 -1
- package/out/us/street-directional.js +4 -2
- package/out/us/street-directional.js.map +1 -1
- package/out/us/zipcode.d.ts +1 -1
- package/package.json +4 -2
|
@@ -25,8 +25,8 @@ export interface AddressSystemConventions {
|
|
|
25
25
|
*/
|
|
26
26
|
readonly forbiddenTags?: readonly string[];
|
|
27
27
|
/**
|
|
28
|
-
* The system's canonical postcode shape. A decoded postcode span that is a strict sub-match of
|
|
29
|
-
*
|
|
28
|
+
* The system's canonical postcode shape. A decoded postcode span that is a strict sub-match of a
|
|
29
|
+
* pattern-valid string in the raw text is shape-INVALID for this system and eligible for the
|
|
30
30
|
* snap-only repair (extend/clip to the valid match — never invent a span).
|
|
31
31
|
*/
|
|
32
32
|
readonly postcodePattern?: RegExp;
|
|
@@ -23,10 +23,10 @@ export const ADDRESS_SYSTEM_CONVENTIONS = {
|
|
|
23
23
|
* France (La Poste / AFNOR NF Z 10-011): street types are LEADING particles of the street name
|
|
24
24
|
* ("Rue de Rivoli", "Avenue des Champs-Élysées") — the libpostal French dictionaries carry no
|
|
25
25
|
* trailing street-suffix class, and the USPS Pub-28 prefix/suffix decomposition has no French
|
|
26
|
-
* counterpart. `street_prefix`/`street_suffix` therefore cannot occur in a French parse; any
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
26
|
+
* counterpart. `street_prefix`/`street_suffix` therefore cannot occur in a French parse; any such
|
|
27
|
+
* emission is US-convention leakage (measured: the 2026-06-10 v1.1.0 gate, where USPS suffix
|
|
28
|
+
* logic fired on "Rue" — RUE is genuinely a Pub-28 suffix variant — and digit-splits corrupted
|
|
29
|
+
* leading postcodes). Postcode: exactly five digits (NF Z 10-011; see fr/code-postal).
|
|
30
30
|
*/
|
|
31
31
|
fr: {
|
|
32
32
|
forbiddenTags: ["street_prefix", "street_suffix"],
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Australia Post delivery-service designators (Postal Delivery Types) — the Commonwealth po_box
|
|
7
|
+
* vocabulary the US-only `us/po-box.ts` cannot see: `GPO Box 2890`, `Locked Bag 1797`, `Private
|
|
8
|
+
* Bag 7`, plus the rural/community legacy tail (`RMB 4600`, `RSD`, `CMB`).
|
|
9
|
+
*
|
|
10
|
+
* Sourcing (accessed 2026-06-11; the underlying urban/rural addressing standard is AS/NZS 4819,
|
|
11
|
+
* which governs street addressing — the delivery-service designators below are Australia Post's
|
|
12
|
+
* own, from its addressing guidance):
|
|
13
|
+
*
|
|
14
|
+
* - The complete Postal Delivery Type table comes verbatim from Australia Post's barcode addressing
|
|
15
|
+
* booklet ("Hints and tips to get a higher address match rate", SAP 8838883): CARE OF POST
|
|
16
|
+
* OFFICE→CARE PO, COMMUNITY MAIL AGENT→CMA, COMMUNITY MAIL BAG→CMB, GENERAL POST OFFICE
|
|
17
|
+
* BOX→GPO BOX, LOCKED MAIL BAG SERVICE→LOCKED BAG, MAIL SERVICE→MS, POST OFFICE BOX→PO BOX,
|
|
18
|
+
* POSTE RESTANTE→CARE PO, PRIVATE MAIL BAG SERVICE→PRIVATE BAG, ROADSIDE DELIVERY→RSD,
|
|
19
|
+
* ROADSIDE MAIL BAG→RMB, ROADSIDE MAIL BOX→RMB, ROADSIDE MAIL SERVICE→RMS, COMMUNITY POSTAL
|
|
20
|
+
* AGENT→CPA. The same booklet states: "With the exception of Care of Post Office, Community
|
|
21
|
+
* Mail Agent, Community Postal Agent, and Community Mail Bag, all Postal Delivery Types must
|
|
22
|
+
* have an associated number for a match to occur. e.g. PO Box 112", and "'PRIVATE BOX' is not
|
|
23
|
+
* a valid type" (so PRIVATE BOX is deliberately NOT in this table).
|
|
24
|
+
* - Which designators are CURRENT retail products (vs. AMAS-recognized legacy forms) comes from the
|
|
25
|
+
* live auspost.com.au pages: the addressing guidelines ("Line 2 should contain the street
|
|
26
|
+
* number and name, or PO Box or Locked Bag number"), the Correct Addressing brochure (SAP
|
|
27
|
+
* 8833878, Nov 2022 — `GPO Box 123 / SYDNEY NSW 2000` example), the personal "PO Boxes and
|
|
28
|
+
* Private Bags" page (Private Bag: "If you live in a rural or remote area of Australia, you
|
|
29
|
+
* can manage your mail securely with a Private Bag"), and the business "PO Boxes and Locked
|
|
30
|
+
* Bags" page (GPO Box: "Lease a single GPO Box, or the same box number in each capital city
|
|
31
|
+
* with our Common Box service"; Common Box numbers run 9800–9999). PO Box, GPO Box, Locked
|
|
32
|
+
* Bag, and Private Bag appear on those current pages; the rural/community types (RSD, RMB,
|
|
33
|
+
* RMS, MS, CMB, CMA, CPA, Care PO) appear ONLY in the AMAS table and are flagged `legacy` —
|
|
34
|
+
* the parser must still recognize them on older addresses.
|
|
35
|
+
*
|
|
36
|
+
* @see {@link https://auspost.com.au/content/dam/auspost_corp/media/documents/Barcode_hints_tips.pdf Australia Post barcode addressing booklet (Postal Delivery Type table)}
|
|
37
|
+
* @see {@link https://auspost.com.au/sending/guidelines/addressing-guidelines Australia Post addressing guidelines}
|
|
38
|
+
* @see {@link https://auspost.com.au/content/dam/auspost_corp/media/documents/correct-addressing.pdf Australia Post Correct Addressing brochure (Nov 2022)}
|
|
39
|
+
* @see {@link https://auspost.com.au/receiving/manage-your-mail/po-boxes-and-private-bags Australia Post — PO Boxes and Private Bags}
|
|
40
|
+
* @see {@link https://auspost.com.au/business/business-admin/po-boxes-and-locked-bags Australia Post — business PO Boxes, GPO Boxes and Locked Bags}
|
|
41
|
+
*/
|
|
42
|
+
/** One Postal Delivery Type row from the Australia Post AMAS abbreviation table. */
|
|
43
|
+
export interface AuDeliveryServiceDesignator {
|
|
44
|
+
/** The full Postal Delivery Type name, verbatim from the table (uppercase as published). */
|
|
45
|
+
name: string;
|
|
46
|
+
/** The standard abbreviation — the surface form written on mail ("GPO BOX", "LOCKED BAG"). */
|
|
47
|
+
abbreviation: string;
|
|
48
|
+
/**
|
|
49
|
+
* Whether the designator "must have an associated number for a match to occur" (AMAS rule;
|
|
50
|
+
* exceptions are Care of Post Office, Community Mail Agent, Community Postal Agent, and Community
|
|
51
|
+
* Mail Bag).
|
|
52
|
+
*/
|
|
53
|
+
requiresNumber: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* True when the designator is recognized by the AMAS Postal Delivery Type table but absent from
|
|
56
|
+
* every current auspost.com.au addressing/product page (accessed 2026-06-11) — the rural and
|
|
57
|
+
* community forms superseded by rural street addressing under AS/NZS 4819. The parser must still
|
|
58
|
+
* RECOGNIZE these on old addresses; synthesis should weight them low.
|
|
59
|
+
*/
|
|
60
|
+
legacy: boolean;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The verbatim Postal Delivery Type table (see the module header for the per-row provenance).
|
|
64
|
+
* Multiple names can share an abbreviation (ROADSIDE MAIL BAG and ROADSIDE MAIL BOX are both RMB;
|
|
65
|
+
* POSTE RESTANTE is addressed as CARE PO).
|
|
66
|
+
*/
|
|
67
|
+
export declare const AU_DELIVERY_SERVICE_DESIGNATORS: readonly [{
|
|
68
|
+
readonly name: "GENERAL POST OFFICE BOX";
|
|
69
|
+
readonly abbreviation: "GPO BOX";
|
|
70
|
+
readonly requiresNumber: true;
|
|
71
|
+
readonly legacy: false;
|
|
72
|
+
}, {
|
|
73
|
+
readonly name: "POST OFFICE BOX";
|
|
74
|
+
readonly abbreviation: "PO BOX";
|
|
75
|
+
readonly requiresNumber: true;
|
|
76
|
+
readonly legacy: false;
|
|
77
|
+
}, {
|
|
78
|
+
readonly name: "LOCKED MAIL BAG SERVICE";
|
|
79
|
+
readonly abbreviation: "LOCKED BAG";
|
|
80
|
+
readonly requiresNumber: true;
|
|
81
|
+
readonly legacy: false;
|
|
82
|
+
}, {
|
|
83
|
+
readonly name: "PRIVATE MAIL BAG SERVICE";
|
|
84
|
+
readonly abbreviation: "PRIVATE BAG";
|
|
85
|
+
readonly requiresNumber: true;
|
|
86
|
+
readonly legacy: false;
|
|
87
|
+
}, {
|
|
88
|
+
readonly name: "COMMUNITY MAIL BAG";
|
|
89
|
+
readonly abbreviation: "CMB";
|
|
90
|
+
readonly requiresNumber: false;
|
|
91
|
+
readonly legacy: true;
|
|
92
|
+
}, {
|
|
93
|
+
readonly name: "COMMUNITY MAIL AGENT";
|
|
94
|
+
readonly abbreviation: "CMA";
|
|
95
|
+
readonly requiresNumber: false;
|
|
96
|
+
readonly legacy: true;
|
|
97
|
+
}, {
|
|
98
|
+
readonly name: "COMMUNITY POSTAL AGENT";
|
|
99
|
+
readonly abbreviation: "CPA";
|
|
100
|
+
readonly requiresNumber: false;
|
|
101
|
+
readonly legacy: true;
|
|
102
|
+
}, {
|
|
103
|
+
readonly name: "CARE OF POST OFFICE";
|
|
104
|
+
readonly abbreviation: "CARE PO";
|
|
105
|
+
readonly requiresNumber: false;
|
|
106
|
+
readonly legacy: true;
|
|
107
|
+
}, {
|
|
108
|
+
readonly name: "POSTE RESTANTE";
|
|
109
|
+
readonly abbreviation: "CARE PO";
|
|
110
|
+
readonly requiresNumber: false;
|
|
111
|
+
readonly legacy: true;
|
|
112
|
+
}, {
|
|
113
|
+
readonly name: "MAIL SERVICE";
|
|
114
|
+
readonly abbreviation: "MS";
|
|
115
|
+
readonly requiresNumber: true;
|
|
116
|
+
readonly legacy: true;
|
|
117
|
+
}, {
|
|
118
|
+
readonly name: "ROADSIDE DELIVERY";
|
|
119
|
+
readonly abbreviation: "RSD";
|
|
120
|
+
readonly requiresNumber: true;
|
|
121
|
+
readonly legacy: true;
|
|
122
|
+
}, {
|
|
123
|
+
readonly name: "ROADSIDE MAIL BAG";
|
|
124
|
+
readonly abbreviation: "RMB";
|
|
125
|
+
readonly requiresNumber: true;
|
|
126
|
+
readonly legacy: true;
|
|
127
|
+
}, {
|
|
128
|
+
readonly name: "ROADSIDE MAIL BOX";
|
|
129
|
+
readonly abbreviation: "RMB";
|
|
130
|
+
readonly requiresNumber: true;
|
|
131
|
+
readonly legacy: true;
|
|
132
|
+
}, {
|
|
133
|
+
readonly name: "ROADSIDE MAIL SERVICE";
|
|
134
|
+
readonly abbreviation: "RMS";
|
|
135
|
+
readonly requiresNumber: true;
|
|
136
|
+
readonly legacy: true;
|
|
137
|
+
}];
|
|
138
|
+
/** A canonical Australia Post Postal Delivery Type abbreviation. */
|
|
139
|
+
export type AuDeliveryServiceAbbreviation = (typeof AU_DELIVERY_SERVICE_DESIGNATORS)[number]["abbreviation"];
|
|
140
|
+
/** Result of an AU delivery-service parse. */
|
|
141
|
+
export interface AuDeliveryServiceMatch {
|
|
142
|
+
/** The designator phrase as it appeared ("G.P.O. Box", "Locked Bag"). */
|
|
143
|
+
matched: string;
|
|
144
|
+
/** The canonical Postal Delivery Type abbreviation ("GPO BOX", "LOCKED BAG"). */
|
|
145
|
+
designator: AuDeliveryServiceAbbreviation;
|
|
146
|
+
/** The delivery-service number when present ("9999", "4600"). */
|
|
147
|
+
id?: string;
|
|
148
|
+
/** True when the designator is an AMAS-only legacy form (see the table). */
|
|
149
|
+
legacy: boolean;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* If `input` is a standalone Australia Post delivery-service phrase ("GPO Box 2890", "Locked Bag
|
|
153
|
+
* 1797", "RMB 4600", bare "CMB"), return the canonical designator, the id, and the legacy flag.
|
|
154
|
+
* Null otherwise — including for "Private Box", which Australia Post explicitly calls out as not a
|
|
155
|
+
* valid type.
|
|
156
|
+
*/
|
|
157
|
+
export declare function matchAuDeliveryService(input: unknown): AuDeliveryServiceMatch | null;
|
|
158
|
+
/** Type-predicate: does the input look like a standalone AU delivery-service address line? */
|
|
159
|
+
export declare function isAuDeliveryService(input: unknown): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Normalize a recognized delivery-service phrase to the canonical AMAS form (`"g.p.o. box 123"` →
|
|
162
|
+
* `"GPO BOX 123"`). Returns the input unchanged if it isn't one.
|
|
163
|
+
*/
|
|
164
|
+
export declare function normalizeAuDeliveryService(input: string): string;
|
|
165
|
+
//# sourceMappingURL=delivery-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delivery-service.d.ts","sourceRoot":"","sources":["../../au/delivery-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,oFAAoF;AACpF,MAAM,WAAW,2BAA2B;IAC3C,4FAA4F;IAC5F,IAAI,EAAE,MAAM,CAAA;IACZ,8FAA8F;IAC9F,YAAY,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,cAAc,EAAE,OAAO,CAAA;IACvB;;;;;OAKG;IACH,MAAM,EAAE,OAAO,CAAA;CACf;AAED;;;;GAIG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAee,CAAA;AAE3D,oEAAoE;AACpE,MAAM,MAAM,6BAA6B,GAAG,CAAC,OAAO,+BAA+B,CAAC,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAA;AAyC5G,8CAA8C;AAC9C,MAAM,WAAW,sBAAsB;IACtC,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAA;IACf,iFAAiF;IACjF,UAAU,EAAE,6BAA6B,CAAA;IACzC,iEAAiE;IACjE,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,4EAA4E;IAC5E,MAAM,EAAE,OAAO,CAAA;CACf;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,sBAAsB,GAAG,IAAI,CAcpF;AAED,8FAA8F;AAC9F,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE3D;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIhE"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Australia Post delivery-service designators (Postal Delivery Types) — the Commonwealth po_box
|
|
7
|
+
* vocabulary the US-only `us/po-box.ts` cannot see: `GPO Box 2890`, `Locked Bag 1797`, `Private
|
|
8
|
+
* Bag 7`, plus the rural/community legacy tail (`RMB 4600`, `RSD`, `CMB`).
|
|
9
|
+
*
|
|
10
|
+
* Sourcing (accessed 2026-06-11; the underlying urban/rural addressing standard is AS/NZS 4819,
|
|
11
|
+
* which governs street addressing — the delivery-service designators below are Australia Post's
|
|
12
|
+
* own, from its addressing guidance):
|
|
13
|
+
*
|
|
14
|
+
* - The complete Postal Delivery Type table comes verbatim from Australia Post's barcode addressing
|
|
15
|
+
* booklet ("Hints and tips to get a higher address match rate", SAP 8838883): CARE OF POST
|
|
16
|
+
* OFFICE→CARE PO, COMMUNITY MAIL AGENT→CMA, COMMUNITY MAIL BAG→CMB, GENERAL POST OFFICE
|
|
17
|
+
* BOX→GPO BOX, LOCKED MAIL BAG SERVICE→LOCKED BAG, MAIL SERVICE→MS, POST OFFICE BOX→PO BOX,
|
|
18
|
+
* POSTE RESTANTE→CARE PO, PRIVATE MAIL BAG SERVICE→PRIVATE BAG, ROADSIDE DELIVERY→RSD,
|
|
19
|
+
* ROADSIDE MAIL BAG→RMB, ROADSIDE MAIL BOX→RMB, ROADSIDE MAIL SERVICE→RMS, COMMUNITY POSTAL
|
|
20
|
+
* AGENT→CPA. The same booklet states: "With the exception of Care of Post Office, Community
|
|
21
|
+
* Mail Agent, Community Postal Agent, and Community Mail Bag, all Postal Delivery Types must
|
|
22
|
+
* have an associated number for a match to occur. e.g. PO Box 112", and "'PRIVATE BOX' is not
|
|
23
|
+
* a valid type" (so PRIVATE BOX is deliberately NOT in this table).
|
|
24
|
+
* - Which designators are CURRENT retail products (vs. AMAS-recognized legacy forms) comes from the
|
|
25
|
+
* live auspost.com.au pages: the addressing guidelines ("Line 2 should contain the street
|
|
26
|
+
* number and name, or PO Box or Locked Bag number"), the Correct Addressing brochure (SAP
|
|
27
|
+
* 8833878, Nov 2022 — `GPO Box 123 / SYDNEY NSW 2000` example), the personal "PO Boxes and
|
|
28
|
+
* Private Bags" page (Private Bag: "If you live in a rural or remote area of Australia, you
|
|
29
|
+
* can manage your mail securely with a Private Bag"), and the business "PO Boxes and Locked
|
|
30
|
+
* Bags" page (GPO Box: "Lease a single GPO Box, or the same box number in each capital city
|
|
31
|
+
* with our Common Box service"; Common Box numbers run 9800–9999). PO Box, GPO Box, Locked
|
|
32
|
+
* Bag, and Private Bag appear on those current pages; the rural/community types (RSD, RMB,
|
|
33
|
+
* RMS, MS, CMB, CMA, CPA, Care PO) appear ONLY in the AMAS table and are flagged `legacy` —
|
|
34
|
+
* the parser must still recognize them on older addresses.
|
|
35
|
+
*
|
|
36
|
+
* @see {@link https://auspost.com.au/content/dam/auspost_corp/media/documents/Barcode_hints_tips.pdf Australia Post barcode addressing booklet (Postal Delivery Type table)}
|
|
37
|
+
* @see {@link https://auspost.com.au/sending/guidelines/addressing-guidelines Australia Post addressing guidelines}
|
|
38
|
+
* @see {@link https://auspost.com.au/content/dam/auspost_corp/media/documents/correct-addressing.pdf Australia Post Correct Addressing brochure (Nov 2022)}
|
|
39
|
+
* @see {@link https://auspost.com.au/receiving/manage-your-mail/po-boxes-and-private-bags Australia Post — PO Boxes and Private Bags}
|
|
40
|
+
* @see {@link https://auspost.com.au/business/business-admin/po-boxes-and-locked-bags Australia Post — business PO Boxes, GPO Boxes and Locked Bags}
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* The verbatim Postal Delivery Type table (see the module header for the per-row provenance).
|
|
44
|
+
* Multiple names can share an abbreviation (ROADSIDE MAIL BAG and ROADSIDE MAIL BOX are both RMB;
|
|
45
|
+
* POSTE RESTANTE is addressed as CARE PO).
|
|
46
|
+
*/
|
|
47
|
+
export const AU_DELIVERY_SERVICE_DESIGNATORS = [
|
|
48
|
+
{ name: "GENERAL POST OFFICE BOX", abbreviation: "GPO BOX", requiresNumber: true, legacy: false },
|
|
49
|
+
{ name: "POST OFFICE BOX", abbreviation: "PO BOX", requiresNumber: true, legacy: false },
|
|
50
|
+
{ name: "LOCKED MAIL BAG SERVICE", abbreviation: "LOCKED BAG", requiresNumber: true, legacy: false },
|
|
51
|
+
{ name: "PRIVATE MAIL BAG SERVICE", abbreviation: "PRIVATE BAG", requiresNumber: true, legacy: false },
|
|
52
|
+
{ name: "COMMUNITY MAIL BAG", abbreviation: "CMB", requiresNumber: false, legacy: true },
|
|
53
|
+
{ name: "COMMUNITY MAIL AGENT", abbreviation: "CMA", requiresNumber: false, legacy: true },
|
|
54
|
+
{ name: "COMMUNITY POSTAL AGENT", abbreviation: "CPA", requiresNumber: false, legacy: true },
|
|
55
|
+
{ name: "CARE OF POST OFFICE", abbreviation: "CARE PO", requiresNumber: false, legacy: true },
|
|
56
|
+
{ name: "POSTE RESTANTE", abbreviation: "CARE PO", requiresNumber: false, legacy: true },
|
|
57
|
+
{ name: "MAIL SERVICE", abbreviation: "MS", requiresNumber: true, legacy: true },
|
|
58
|
+
{ name: "ROADSIDE DELIVERY", abbreviation: "RSD", requiresNumber: true, legacy: true },
|
|
59
|
+
{ name: "ROADSIDE MAIL BAG", abbreviation: "RMB", requiresNumber: true, legacy: true },
|
|
60
|
+
{ name: "ROADSIDE MAIL BOX", abbreviation: "RMB", requiresNumber: true, legacy: true },
|
|
61
|
+
{ name: "ROADSIDE MAIL SERVICE", abbreviation: "RMS", requiresNumber: true, legacy: true },
|
|
62
|
+
];
|
|
63
|
+
/**
|
|
64
|
+
* Per-designator surface patterns (designator phrase only, no anchor, no id). Ordered longest /
|
|
65
|
+
* most-specific first so the matcher prefers "GPO Box" over "PO Box" and "RMS" over "MS". Each
|
|
66
|
+
* pattern tolerates the punctuation AMAS tells mailers to strip ("the full stops and commas in
|
|
67
|
+
* R.M.B and P.O.") — recognition must accept what deliverable mail actually carries.
|
|
68
|
+
*
|
|
69
|
+
* MS is special-cased in {@link matchAuDeliveryService}: its identifier must start with a digit so
|
|
70
|
+
* the bare two-letter designator cannot swallow an honorific ("Ms Smith").
|
|
71
|
+
*/
|
|
72
|
+
const DESIGNATOR_PATTERNS = [
|
|
73
|
+
["GPO BOX", String.raw `general\s+post\s+office\s+box|g\.?\s*p\.?\s*o\.?\s*box`],
|
|
74
|
+
["PO BOX", String.raw `post\s+office\s+box|p\.?\s*o\.?\s*box`],
|
|
75
|
+
["LOCKED BAG", String.raw `locked\s+(?:mail\s+)?bag(?:\s+service)?`],
|
|
76
|
+
["PRIVATE BAG", String.raw `private\s+(?:mail\s+)?bag(?:\s+service)?`],
|
|
77
|
+
["CARE PO", String.raw `care\s+of\s+post\s+office|poste\s+restante|care\s+po`],
|
|
78
|
+
["CMB", String.raw `community\s+mail\s+bag|cmb`],
|
|
79
|
+
["CMA", String.raw `community\s+mail\s+agent|cma`],
|
|
80
|
+
["CPA", String.raw `community\s+postal\s+agent|cpa`],
|
|
81
|
+
["RSD", String.raw `roadside\s+delivery|r\.?\s*s\.?\s*d\.?`],
|
|
82
|
+
["RMB", String.raw `roadside\s+mail\s+(?:bag|box)|r\.?\s*m\.?\s*b\.?`],
|
|
83
|
+
["RMS", String.raw `roadside\s+mail\s+service|rms`],
|
|
84
|
+
["MS", String.raw `mail\s+service|ms`],
|
|
85
|
+
];
|
|
86
|
+
const DESIGNATOR_INFO = new Map(AU_DELIVERY_SERVICE_DESIGNATORS.map((d) => [d.abbreviation, { requiresNumber: d.requiresNumber, legacy: d.legacy }]));
|
|
87
|
+
// One anchored regex per designator: phrase + (required|optional) identifier. The id shape matches
|
|
88
|
+
// the US slice ([\dA-Za-z][\dA-Za-z-]*); MS additionally requires a digit-leading id (see above).
|
|
89
|
+
const MATCHERS = DESIGNATOR_PATTERNS.map(([abbreviation, src]) => {
|
|
90
|
+
const { requiresNumber } = DESIGNATOR_INFO.get(abbreviation);
|
|
91
|
+
const id = abbreviation === "MS" ? String.raw `(\d[\dA-Za-z-]*)` : String.raw `([\dA-Za-z][\dA-Za-z-]*)`;
|
|
92
|
+
const tail = requiresNumber ? String.raw `\s*#?\s*${id}` : String.raw `(?:\s*#?\s*${id})?`;
|
|
93
|
+
return { abbreviation, re: new RegExp(String.raw `^\s*(${src})${tail}\s*$`, "i") };
|
|
94
|
+
});
|
|
95
|
+
/**
|
|
96
|
+
* If `input` is a standalone Australia Post delivery-service phrase ("GPO Box 2890", "Locked Bag
|
|
97
|
+
* 1797", "RMB 4600", bare "CMB"), return the canonical designator, the id, and the legacy flag.
|
|
98
|
+
* Null otherwise — including for "Private Box", which Australia Post explicitly calls out as not a
|
|
99
|
+
* valid type.
|
|
100
|
+
*/
|
|
101
|
+
export function matchAuDeliveryService(input) {
|
|
102
|
+
if (typeof input !== "string")
|
|
103
|
+
return null;
|
|
104
|
+
for (const { abbreviation, re } of MATCHERS) {
|
|
105
|
+
const m = re.exec(input);
|
|
106
|
+
if (!m)
|
|
107
|
+
continue;
|
|
108
|
+
const info = DESIGNATOR_INFO.get(abbreviation);
|
|
109
|
+
return {
|
|
110
|
+
matched: m[1].trim(),
|
|
111
|
+
designator: abbreviation,
|
|
112
|
+
...(m[2] ? { id: m[2] } : {}),
|
|
113
|
+
legacy: info.legacy,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
/** Type-predicate: does the input look like a standalone AU delivery-service address line? */
|
|
119
|
+
export function isAuDeliveryService(input) {
|
|
120
|
+
return matchAuDeliveryService(input) !== null;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Normalize a recognized delivery-service phrase to the canonical AMAS form (`"g.p.o. box 123"` →
|
|
124
|
+
* `"GPO BOX 123"`). Returns the input unchanged if it isn't one.
|
|
125
|
+
*/
|
|
126
|
+
export function normalizeAuDeliveryService(input) {
|
|
127
|
+
const m = matchAuDeliveryService(input);
|
|
128
|
+
if (!m)
|
|
129
|
+
return input;
|
|
130
|
+
return m.id ? `${m.designator} ${m.id.toUpperCase()}` : m.designator;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=delivery-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delivery-service.js","sourceRoot":"","sources":["../../au/delivery-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAuBH;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC9C,EAAE,IAAI,EAAE,yBAAyB,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;IACjG,EAAE,IAAI,EAAE,iBAAiB,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;IACxF,EAAE,IAAI,EAAE,yB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,CAAC;IACD,OAAO,IAAI,CAAA;AACZ,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,mBAAmB,CAAC,KAAc;IACjD,OAAO,sBAAsB,CAAC,KAAK,CAAC,KAAK,IAAI,CAAA;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAC,KAAa;IACvD,MAAM,CAAC,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAA;IACvC,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAA;IACpB,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAA;AACrE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The Australian address system (Australia Post / ISO 3166-2:AU; street addressing per AS/NZS
|
|
7
|
+
* 4819): delivery-service designators (GPO Box, Locked Bag, Private Bag, the rural legacy tail),
|
|
8
|
+
* AMAS / AS 4590.1 floor/level designators (Level 3, Ground Floor, Mezzanine), states and
|
|
9
|
+
* territories, and the 4-digit postcode.
|
|
10
|
+
*/
|
|
11
|
+
export * from "./delivery-service.js";
|
|
12
|
+
export * from "./level-designator.js";
|
|
13
|
+
export * from "./postcode.js";
|
|
14
|
+
export * from "./state.js";
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../au/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
|
package/out/au/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The Australian address system (Australia Post / ISO 3166-2:AU; street addressing per AS/NZS
|
|
7
|
+
* 4819): delivery-service designators (GPO Box, Locked Bag, Private Bag, the rural legacy tail),
|
|
8
|
+
* AMAS / AS 4590.1 floor/level designators (Level 3, Ground Floor, Mezzanine), states and
|
|
9
|
+
* territories, and the 4-digit postcode.
|
|
10
|
+
*/
|
|
11
|
+
export * from "./delivery-service.js";
|
|
12
|
+
export * from "./level-designator.js";
|
|
13
|
+
export * from "./postcode.js";
|
|
14
|
+
export * from "./state.js";
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../au/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Australia Post AMAS floor/level designators — the sub-premise vocabulary that names a FLOOR of a
|
|
7
|
+
* building rather than a numbered unit on that floor: `Level 3`, `L 12`, `Ground Floor`,
|
|
8
|
+
* `Mezzanine`.
|
|
9
|
+
*
|
|
10
|
+
* Sourcing (accessed 2026-06-12):
|
|
11
|
+
*
|
|
12
|
+
* - **Australia Post AMAS** (Address Matching Approval System) defines the Level Designator type and
|
|
13
|
+
* its approved abbreviation. The verbatim AMAS description: "LEVEL" is the full word; "L" is
|
|
14
|
+
* the approved abbreviation. The standard phrase format is `LEVEL <number>`, e.g. "LEVEL 3"
|
|
15
|
+
* or "L 3" (abbreviation always uppercase in AMAS output). Australia Post's own barcode
|
|
16
|
+
* addressing booklet (SAP 8838883) lists "LEVEL" and "L" as the level type; the Correct
|
|
17
|
+
* Addressing brochure (SAP 8833878, Nov 2022) gives the example `LEVEL 3 / 60 MARGARET ST /
|
|
18
|
+
* SYDNEY NSW 2000`. The AMAS Data Extract Format document (v4.2) confirms "LEVEL" → "L" as
|
|
19
|
+
* the sole level abbreviation pair.
|
|
20
|
+
* - **Ground floor** is treated by AMAS as `LEVEL G` (with the identifier "G"). Australia Post's
|
|
21
|
+
* addressing guidelines state that ground floor should be written as "LEVEL G"; the full word
|
|
22
|
+
* "GROUND" is a recognized alias for the identifier, not a separate designator type.
|
|
23
|
+
* - **Mezzanine**, **Lower Ground**, and **Upper Ground** appear in AS 4590.1-2017 (the Australian
|
|
24
|
+
* Standard for interchange of client information) as recognized level-type values alongside
|
|
25
|
+
* LEVEL and GROUND. AS 4590.1-2017 Table 3 "Level type": B (Basement), G (Ground), MEZZANINE
|
|
26
|
+
* (M), LG (Lower Ground), UG (Upper Ground), L (Level), OD (Observation Deck), P (Parking /
|
|
27
|
+
* Podium), RT (Rooftop). These are the values a Geocoded National Address File (GNAF) record
|
|
28
|
+
* may carry in the LEVEL_TYPE_CODE column, which mirrors the AP AMAS level-type vocabulary.
|
|
29
|
+
* - "LVL" and "LG" appear as widely-recognized surface variants in real AU addresses (Open Addresses
|
|
30
|
+
* AU export, accessed via OpenAddresses) though AS 4590.1-2017 and AMAS canonicalize to "L"
|
|
31
|
+
* and "LG" respectively; the variants are included in {@link AU_LEVEL_DESIGNATOR_VARIANTS} so
|
|
32
|
+
* the parser can RECOGNIZE them without synthesizing them.
|
|
33
|
+
*
|
|
34
|
+
* @see {@link https://auspost.com.au/sending/guidelines/addressing-guidelines Australia Post addressing guidelines}
|
|
35
|
+
* @see {@link https://auspost.com.au/content/dam/auspost_corp/media/documents/correct-addressing.pdf Australia Post Correct Addressing brochure (Nov 2022)}
|
|
36
|
+
* @see {@link https://auspost.com.au/content/dam/auspost_corp/media/documents/Barcode_hints_tips.pdf Australia Post barcode addressing booklet}
|
|
37
|
+
* @see {@link https://www.iso.org/standard/67840.html AS 4590.1-2017 — Interchange of client information}
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* One AMAS / AS 4590.1 level-type row.
|
|
41
|
+
*
|
|
42
|
+
* The `type` is the AS 4590.1 LEVEL_TYPE_CODE value (what GNAF and AMAS use internally); the
|
|
43
|
+
* `abbreviation` is the approved surface form used in formatted mail; the `requiresNumber` flag
|
|
44
|
+
* distinguishes designators that take a floor identifier from standalone ones.
|
|
45
|
+
*/
|
|
46
|
+
export interface AuLevelDesignator {
|
|
47
|
+
/** AS 4590.1 LEVEL_TYPE_CODE (the GNAF / AMAS internal code). */
|
|
48
|
+
code: string;
|
|
49
|
+
/** Full descriptive name (AMAS table label). */
|
|
50
|
+
name: string;
|
|
51
|
+
/** The approved AMAS surface abbreviation written on mail ("L", "B", "M"). */
|
|
52
|
+
abbreviation: string;
|
|
53
|
+
/**
|
|
54
|
+
* True when the designator takes a numeric or alphanumeric floor identifier after it (`LEVEL 3`,
|
|
55
|
+
* `BASEMENT 2`). False for standalone types (`GROUND`, `MEZZANINE`, `ROOFTOP`) that name a
|
|
56
|
+
* specific well-known floor by vocabulary alone.
|
|
57
|
+
*/
|
|
58
|
+
requiresNumber: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* AMAS / AS 4590.1-2017 level-type table (Table 3). Verbatim codes; see the module header for
|
|
62
|
+
* provenance. Ordered with the most-common forms first for match priority.
|
|
63
|
+
*/
|
|
64
|
+
export declare const AU_LEVEL_DESIGNATORS: readonly [{
|
|
65
|
+
readonly code: "L";
|
|
66
|
+
readonly name: "LEVEL";
|
|
67
|
+
readonly abbreviation: "L";
|
|
68
|
+
readonly requiresNumber: true;
|
|
69
|
+
}, {
|
|
70
|
+
readonly code: "G";
|
|
71
|
+
readonly name: "GROUND";
|
|
72
|
+
readonly abbreviation: "G";
|
|
73
|
+
readonly requiresNumber: false;
|
|
74
|
+
}, {
|
|
75
|
+
readonly code: "B";
|
|
76
|
+
readonly name: "BASEMENT";
|
|
77
|
+
readonly abbreviation: "B";
|
|
78
|
+
readonly requiresNumber: true;
|
|
79
|
+
}, {
|
|
80
|
+
readonly code: "M";
|
|
81
|
+
readonly name: "MEZZANINE";
|
|
82
|
+
readonly abbreviation: "M";
|
|
83
|
+
readonly requiresNumber: false;
|
|
84
|
+
}, {
|
|
85
|
+
readonly code: "LG";
|
|
86
|
+
readonly name: "LOWER GROUND";
|
|
87
|
+
readonly abbreviation: "LG";
|
|
88
|
+
readonly requiresNumber: false;
|
|
89
|
+
}, {
|
|
90
|
+
readonly code: "UG";
|
|
91
|
+
readonly name: "UPPER GROUND";
|
|
92
|
+
readonly abbreviation: "UG";
|
|
93
|
+
readonly requiresNumber: false;
|
|
94
|
+
}, {
|
|
95
|
+
readonly code: "OD";
|
|
96
|
+
readonly name: "OBSERVATION DECK";
|
|
97
|
+
readonly abbreviation: "OD";
|
|
98
|
+
readonly requiresNumber: false;
|
|
99
|
+
}, {
|
|
100
|
+
readonly code: "P";
|
|
101
|
+
readonly name: "PARKING";
|
|
102
|
+
readonly abbreviation: "P";
|
|
103
|
+
readonly requiresNumber: true;
|
|
104
|
+
}, {
|
|
105
|
+
readonly code: "RT";
|
|
106
|
+
readonly name: "ROOFTOP";
|
|
107
|
+
readonly abbreviation: "RT";
|
|
108
|
+
readonly requiresNumber: false;
|
|
109
|
+
}];
|
|
110
|
+
/** A canonical AS 4590.1 LEVEL_TYPE_CODE. */
|
|
111
|
+
export type AuLevelCode = (typeof AU_LEVEL_DESIGNATORS)[number]["code"];
|
|
112
|
+
/**
|
|
113
|
+
* Recognized surface variants for each AMAS level code — the canonical code/abbreviation pair PLUS
|
|
114
|
+
* additional forms found in real AU addresses (Open Addresses export) that the parser must
|
|
115
|
+
* RECOGNIZE but the synthesis layer should not favor over the canonical form.
|
|
116
|
+
*
|
|
117
|
+
* Synthesis uses only the first element (the AMAS canonical surface). Recognition accepts all.
|
|
118
|
+
*/
|
|
119
|
+
export declare const AU_LEVEL_DESIGNATOR_VARIANTS: Readonly<Record<AuLevelCode, readonly string[]>>;
|
|
120
|
+
/**
|
|
121
|
+
* Inverse lookup: every variant (abbreviation or surface form) → the canonical AMAS code.
|
|
122
|
+
* Lowercase-keyed for case-insensitive matching (`"level"` → `"L"`, `"bsmt"` → `"B"`).
|
|
123
|
+
*/
|
|
124
|
+
export declare const AU_LEVEL_DESIGNATOR_LOOKUP: ReadonlyMap<string, AuLevelCode>;
|
|
125
|
+
/** Result of an AU level designator parse. */
|
|
126
|
+
export interface AuLevelDesignatorMatch {
|
|
127
|
+
/** The code as it appeared in the input ("Level", "L", "lvl"). */
|
|
128
|
+
matched: string;
|
|
129
|
+
/** The canonical AS 4590.1 LEVEL_TYPE_CODE ("L", "B", "M"). */
|
|
130
|
+
code: AuLevelCode;
|
|
131
|
+
/** The floor identifier when present ("3", "G", "B2"). */
|
|
132
|
+
identifier?: string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* If `input` is a standalone AU level designator phrase ("Level 3", "L 12", "Ground Floor",
|
|
136
|
+
* "Mezzanine", "B 2"), return the canonical code and identifier. Null otherwise. Malformed entries
|
|
137
|
+
* (a requires-number designator with no identifier, e.g. bare "Level") return null — the builder
|
|
138
|
+
* throws loudly when a row in a table violates this constraint.
|
|
139
|
+
*/
|
|
140
|
+
export declare function matchAuLevelDesignator(input: unknown): AuLevelDesignatorMatch | null;
|
|
141
|
+
/** Type-predicate: does the input look like a standalone AU level designator phrase? */
|
|
142
|
+
export declare function isAuLevelDesignator(input: unknown): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Normalize a recognized level phrase to the AMAS canonical form (`"level 3"` → `"L 3"`, `"ground
|
|
145
|
+
* floor"` → `"G"`). Returns the input unchanged if it isn't a level designator phrase. Throws if a
|
|
146
|
+
* row in {@link AU_LEVEL_DESIGNATORS} is malformed (requires-number entry with no abbreviation or
|
|
147
|
+
* empty name) — the builder must surface structural defects loudly.
|
|
148
|
+
*/
|
|
149
|
+
export declare function normalizeAuLevelDesignator(input: string): string;
|
|
150
|
+
//# sourceMappingURL=level-designator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"level-designator.d.ts","sourceRoot":"","sources":["../../au/level-designator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IACjC,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAA;IACZ,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAA;IACZ,8EAA8E;IAC9E,YAAY,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,cAAc,EAAE,OAAO,CAAA;CACvB;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUgB,CAAA;AAEjD,6CAA6C;AAC7C,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvE;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC,CAUzF,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAyBpE,CAAA;AAEJ,8CAA8C;AAC9C,MAAM,WAAW,sBAAsB;IACtC,kEAAkE;IAClE,OAAO,EAAE,MAAM,CAAA;IACf,+DAA+D;IAC/D,IAAI,EAAE,WAAW,CAAA;IACjB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB;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