@mailwoman/codex 4.1.0 → 4.3.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 +37 -0
- package/out/address-system-conventions.d.ts.map +1 -0
- package/out/address-system-conventions.js +42 -0
- package/out/address-system-conventions.js.map +1 -0
- package/out/country/codes.d.ts +528 -0
- package/out/country/codes.d.ts.map +1 -0
- package/out/country/codes.js +520 -0
- package/out/country/codes.js.map +1 -0
- package/out/country/country.d.ts +65 -0
- package/out/country/country.d.ts.map +1 -0
- package/out/country/country.js +91 -0
- package/out/country/country.js.map +1 -0
- package/out/country/index.d.ts +11 -0
- package/out/country/index.d.ts.map +1 -0
- package/out/country/index.js +11 -0
- package/out/country/index.js.map +1 -0
- package/out/country/names.d.ts +23 -0
- package/out/country/names.d.ts.map +1 -0
- package/out/country/names.js +264 -0
- package/out/country/names.js.map +1 -0
- package/out/index.d.ts +1 -0
- package/out/index.d.ts.map +1 -1
- package/out/index.js +1 -0
- package/out/index.js.map +1 -1
- package/out/us/index.d.ts +2 -0
- package/out/us/index.d.ts.map +1 -1
- package/out/us/index.js +2 -0
- package/out/us/index.js.map +1 -1
- package/out/us/po-box.d.ts +46 -0
- package/out/us/po-box.d.ts.map +1 -0
- package/out/us/po-box.js +66 -0
- package/out/us/po-box.js.map +1 -0
- package/out/us/state.d.ts +66 -0
- package/out/us/state.d.ts.map +1 -1
- package/out/us/state.js +66 -0
- package/out/us/state.js.map +1 -1
- package/out/us/street-directional.d.ts +102 -0
- package/out/us/street-directional.d.ts.map +1 -0
- package/out/us/street-directional.js +159 -0
- package/out/us/street-directional.js.map +1 -0
- package/out/us/street-suffix.d.ts +1 -6
- package/out/us/street-suffix.d.ts.map +1 -1
- package/out/us/street-suffix.js +1 -9
- package/out/us/street-suffix.js.map +1 -1
- package/out/us/zipcode.d.ts +0 -5
- package/out/us/zipcode.d.ts.map +1 -1
- package/out/us/zipcode.js +0 -5
- package/out/us/zipcode.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Country recognition for the `country` parity lever. The ISO 3166-1 base (names + alpha-2/alpha-3)
|
|
7
|
+
* is salvaged from isp-nexus `spatial/countries` ({@link ./names.ts}, {@link ./codes.ts}); this adds
|
|
8
|
+
* the layer ISO doesn't carry — the **surface forms** addresses actually use (endonyms + common
|
|
9
|
+
* abbreviations: "USA"/"United States"/"U.S."; "Deutschland"/"Germany"; "España"/"Spain") — plus a
|
|
10
|
+
* {@link matchCountry} resolver the corpus country-shard + parsing reuse. Same shape as the other
|
|
11
|
+
* codex matchers (street-suffix, directional, po-box).
|
|
12
|
+
*/
|
|
13
|
+
import { Alpha3ToCountryRecord, CountryISO2 } from "./codes.js";
|
|
14
|
+
import {} from "./names.js";
|
|
15
|
+
/**
|
|
16
|
+
* Common real-address surface forms per ISO 3166-1 alpha-2, **canonical English name first** then
|
|
17
|
+
* endonym + abbreviations. Curated for the corpus locales + frequent countries (NOT a full 249-entry
|
|
18
|
+
* variant table — the ISO base below catches the canonical name/code for everything else). Forms are
|
|
19
|
+
* matched case-insensitively; the first entry is the preferred render form.
|
|
20
|
+
*/
|
|
21
|
+
export const COUNTRY_SURFACE_FORMS = {
|
|
22
|
+
US: ["United States", "USA", "US", "U.S.A.", "U.S.", "United States of America", "America"],
|
|
23
|
+
DE: ["Germany", "Deutschland", "DE", "GER", "Federal Republic of Germany"],
|
|
24
|
+
FR: ["France", "FR", "FRA", "French Republic"],
|
|
25
|
+
GB: ["United Kingdom", "UK", "Great Britain", "Britain", "England", "GB", "U.K."],
|
|
26
|
+
ES: ["Spain", "España", "Espana", "ES", "ESP"],
|
|
27
|
+
IT: ["Italy", "Italia", "IT", "ITA"],
|
|
28
|
+
NL: ["Netherlands", "Nederland", "The Netherlands", "Holland", "NL", "NLD"],
|
|
29
|
+
CA: ["Canada", "CA", "CAN"],
|
|
30
|
+
AU: ["Australia", "AU", "AUS"],
|
|
31
|
+
CH: ["Switzerland", "Schweiz", "Suisse", "Svizzera", "CH"],
|
|
32
|
+
AT: ["Austria", "Österreich", "Osterreich", "AT"],
|
|
33
|
+
BE: ["Belgium", "België", "Belgique", "BE"],
|
|
34
|
+
IE: ["Ireland", "Éire", "IE", "IRL"],
|
|
35
|
+
MX: ["Mexico", "México", "MX", "MEX"],
|
|
36
|
+
JP: ["Japan", "日本", "Nippon", "JP", "JPN"],
|
|
37
|
+
};
|
|
38
|
+
/** alpha-2 → canonical English name (inverted from the salvaged CountryISO2 enum). */
|
|
39
|
+
export const ISO2_TO_NAME = new Map(Object.entries(CountryISO2).map(([name, code]) => [code, name]));
|
|
40
|
+
/**
|
|
41
|
+
* Any recognized country surface form / canonical name / alpha-2 / alpha-3 → alpha-2 code. Built once
|
|
42
|
+
* at module load, lowercase-keyed. Canonical names + codes from the ISO base, plus the curated
|
|
43
|
+
* surface forms (surface forms win on collision — they're the address-facing spellings).
|
|
44
|
+
*/
|
|
45
|
+
export const COUNTRY_LOOKUP = (() => {
|
|
46
|
+
const out = new Map();
|
|
47
|
+
const put = (k, iso2) => {
|
|
48
|
+
const key = k.trim().toLowerCase();
|
|
49
|
+
if (key && !out.has(key))
|
|
50
|
+
out.set(key, iso2);
|
|
51
|
+
};
|
|
52
|
+
// ISO base: canonical name + alpha-2 + alpha-3.
|
|
53
|
+
for (const [name, code] of Object.entries(CountryISO2))
|
|
54
|
+
put(name, code);
|
|
55
|
+
for (const [code] of Object.entries(CountryISO2))
|
|
56
|
+
put(code, code); // "US" -> US
|
|
57
|
+
for (const [alpha3, name] of Object.entries(Alpha3ToCountryRecord)) {
|
|
58
|
+
const iso2 = CountryISO2[name];
|
|
59
|
+
if (iso2)
|
|
60
|
+
put(alpha3, iso2); // "USA" -> US, "DEU" -> DE
|
|
61
|
+
}
|
|
62
|
+
// Curated surface forms (override — address spellings beat the ISO base on collision).
|
|
63
|
+
for (const [iso2, forms] of Object.entries(COUNTRY_SURFACE_FORMS)) {
|
|
64
|
+
for (const f of forms)
|
|
65
|
+
out.set(f.trim().toLowerCase(), iso2);
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
})();
|
|
69
|
+
/**
|
|
70
|
+
* Resolve a token (surface form, canonical name, alpha-2, or alpha-3) to a country. Case-insensitive.
|
|
71
|
+
* Returns null if unrecognized. Multi-word names ("United States", "Great Britain") must be passed as
|
|
72
|
+
* the whole phrase — the caller decides the span; this matches it.
|
|
73
|
+
*/
|
|
74
|
+
export function matchCountry(token) {
|
|
75
|
+
if (!token || typeof token !== "string")
|
|
76
|
+
return null;
|
|
77
|
+
const iso2 = COUNTRY_LOOKUP.get(token.trim().toLowerCase());
|
|
78
|
+
if (!iso2)
|
|
79
|
+
return null;
|
|
80
|
+
return { iso2, canonical: ISO2_TO_NAME.get(iso2), matched: token.trim() };
|
|
81
|
+
}
|
|
82
|
+
/** Case-insensitive check: is the token any recognized country form? */
|
|
83
|
+
export function isCountryToken(token) {
|
|
84
|
+
return typeof token === "string" && COUNTRY_LOOKUP.has(token.trim().toLowerCase());
|
|
85
|
+
}
|
|
86
|
+
/** The preferred render forms for an alpha-2 (canonical first), for synth shards. Empty if none curated. */
|
|
87
|
+
export function countrySurfaceForms(iso2) {
|
|
88
|
+
return COUNTRY_SURFACE_FORMS[iso2.toUpperCase()] ?? [];
|
|
89
|
+
}
|
|
90
|
+
export { CountryISO2, Alpha3ToCountryRecord };
|
|
91
|
+
//# sourceMappingURL=country.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country.js","sourceRoot":"","sources":["../../country/country.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAoB,MAAM,YAAY,CAAA;AACjF,OAAO,EAAoB,MAAM,YAAY,CAA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|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* ISO 3166-1 country reference + surface-form recognition (the `country` parity lever).
|
|
7
|
+
*/
|
|
8
|
+
export * from "./names.js";
|
|
9
|
+
export * from "./codes.js";
|
|
10
|
+
export * from "./country.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../country/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* ISO 3166-1 country reference + surface-form recognition (the `country` parity lever).
|
|
7
|
+
*/
|
|
8
|
+
export * from "./names.js";
|
|
9
|
+
export * from "./codes.js";
|
|
10
|
+
export * from "./country.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../country/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software (ISO 3166-1 data salvaged from isp-nexus)
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* List of all countries in the world.
|
|
8
|
+
*
|
|
9
|
+
* @category Geographic
|
|
10
|
+
* @internal
|
|
11
|
+
* @see https://en.wikipedia.org/wiki/List_of_countries
|
|
12
|
+
*/
|
|
13
|
+
export declare const CountryNames: readonly ["Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bonaire, Sint Eustatius and Saba", "Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote DIvoire", "Croatia", "Cuba", "Curaçao", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)", "Faroe Islands", "Fiji", "Finland", "France", "French Guiana", "French Polynesia", "French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guernsey", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard Island and Mcdonald Islands", "Holy See (Vatican City State)", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran, Islamic Republic of", "Iraq", "Ireland", "Isle of Man", "Israel", "Italy", "Jamaica", "Japan", "Jersey", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, Democratic People's Republic of", "Korea, Republic of", "Kuwait", "Kyrgyzstan", "Lao People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macao", "Macedonia, the Former Yugoslav Republic of", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States of", "Moldova, Republic of", "Monaco", "Mongolia", "Montenegro", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Palestine, State of", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation", "Rwanda", "Saint Barthélemy", "Saint Helena, Ascension and Tristan da Cunha", "Saint Kitts and Nevis", "Saint Lucia", "Saint Martin (French part)", "Saint Pierre and Miquelon", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore", "Sint Maarten (Dutch part)", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "South Sudan", "Spain", "Sri Lanka", "Sudan", "Suriname", "Svalbard and Jan Mayen", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic", "Taiwan (Province of China)", "Tajikistan", "Tanzania, United Republic of", "Thailand", "Timor-Leste", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", "Viet Nam", "Virgin Islands (British)", "Virgin Islands (U.S.)", "Wallis and Futuna", "Western Sahara", "Yemen", "Zambia", "Zimbabwe", "Åland Islands"];
|
|
14
|
+
/**
|
|
15
|
+
* Name of a country in the world.
|
|
16
|
+
*
|
|
17
|
+
* @category Geographic
|
|
18
|
+
* @category Country
|
|
19
|
+
* @title Country Name
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export type CountryName = (typeof CountryNames)[number];
|
|
23
|
+
//# sourceMappingURL=names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"names.d.ts","sourceRoot":"","sources":["../../country/names.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,4sHA0Pa,CAAA;AAEtC;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software (ISO 3166-1 data salvaged from isp-nexus)
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* List of all countries in the world.
|
|
8
|
+
*
|
|
9
|
+
* @category Geographic
|
|
10
|
+
* @internal
|
|
11
|
+
* @see https://en.wikipedia.org/wiki/List_of_countries
|
|
12
|
+
*/
|
|
13
|
+
export const CountryNames = [
|
|
14
|
+
"Afghanistan",
|
|
15
|
+
"Albania",
|
|
16
|
+
"Algeria",
|
|
17
|
+
"American Samoa",
|
|
18
|
+
"Andorra",
|
|
19
|
+
"Angola",
|
|
20
|
+
"Anguilla",
|
|
21
|
+
"Antarctica",
|
|
22
|
+
"Antigua and Barbuda",
|
|
23
|
+
"Argentina",
|
|
24
|
+
"Armenia",
|
|
25
|
+
"Aruba",
|
|
26
|
+
"Australia",
|
|
27
|
+
"Austria",
|
|
28
|
+
"Azerbaijan",
|
|
29
|
+
"Bahamas",
|
|
30
|
+
"Bahrain",
|
|
31
|
+
"Bangladesh",
|
|
32
|
+
"Barbados",
|
|
33
|
+
"Belarus",
|
|
34
|
+
"Belgium",
|
|
35
|
+
"Belize",
|
|
36
|
+
"Benin",
|
|
37
|
+
"Bermuda",
|
|
38
|
+
"Bhutan",
|
|
39
|
+
"Bolivia",
|
|
40
|
+
"Bonaire, Sint Eustatius and Saba",
|
|
41
|
+
"Bosnia and Herzegovina",
|
|
42
|
+
"Botswana",
|
|
43
|
+
"Bouvet Island",
|
|
44
|
+
"Brazil",
|
|
45
|
+
"British Indian Ocean Territory",
|
|
46
|
+
"Brunei Darussalam",
|
|
47
|
+
"Bulgaria",
|
|
48
|
+
"Burkina Faso",
|
|
49
|
+
"Burundi",
|
|
50
|
+
"Cambodia",
|
|
51
|
+
"Cameroon",
|
|
52
|
+
"Canada",
|
|
53
|
+
"Cape Verde",
|
|
54
|
+
"Cayman Islands",
|
|
55
|
+
"Central African Republic",
|
|
56
|
+
"Chad",
|
|
57
|
+
"Chile",
|
|
58
|
+
"China",
|
|
59
|
+
"Christmas Island",
|
|
60
|
+
"Cocos (Keeling) Islands",
|
|
61
|
+
"Colombia",
|
|
62
|
+
"Comoros",
|
|
63
|
+
"Congo",
|
|
64
|
+
"Congo, the Democratic Republic of the",
|
|
65
|
+
"Cook Islands",
|
|
66
|
+
"Costa Rica",
|
|
67
|
+
"Cote DIvoire",
|
|
68
|
+
"Croatia",
|
|
69
|
+
"Cuba",
|
|
70
|
+
"Curaçao",
|
|
71
|
+
"Cyprus",
|
|
72
|
+
"Czech Republic",
|
|
73
|
+
"Denmark",
|
|
74
|
+
"Djibouti",
|
|
75
|
+
"Dominica",
|
|
76
|
+
"Dominican Republic",
|
|
77
|
+
"Ecuador",
|
|
78
|
+
"Egypt",
|
|
79
|
+
"El Salvador",
|
|
80
|
+
"Equatorial Guinea",
|
|
81
|
+
"Eritrea",
|
|
82
|
+
"Estonia",
|
|
83
|
+
"Ethiopia",
|
|
84
|
+
"Falkland Islands (Malvinas)",
|
|
85
|
+
"Faroe Islands",
|
|
86
|
+
"Fiji",
|
|
87
|
+
"Finland",
|
|
88
|
+
"France",
|
|
89
|
+
"French Guiana",
|
|
90
|
+
"French Polynesia",
|
|
91
|
+
"French Southern Territories",
|
|
92
|
+
"Gabon",
|
|
93
|
+
"Gambia",
|
|
94
|
+
"Georgia",
|
|
95
|
+
"Germany",
|
|
96
|
+
"Ghana",
|
|
97
|
+
"Gibraltar",
|
|
98
|
+
"Greece",
|
|
99
|
+
"Greenland",
|
|
100
|
+
"Grenada",
|
|
101
|
+
"Guadeloupe",
|
|
102
|
+
"Guam",
|
|
103
|
+
"Guatemala",
|
|
104
|
+
"Guernsey",
|
|
105
|
+
"Guinea",
|
|
106
|
+
"Guinea-Bissau",
|
|
107
|
+
"Guyana",
|
|
108
|
+
"Haiti",
|
|
109
|
+
"Heard Island and Mcdonald Islands",
|
|
110
|
+
"Holy See (Vatican City State)",
|
|
111
|
+
"Honduras",
|
|
112
|
+
"Hong Kong",
|
|
113
|
+
"Hungary",
|
|
114
|
+
"Iceland",
|
|
115
|
+
"India",
|
|
116
|
+
"Indonesia",
|
|
117
|
+
"Iran, Islamic Republic of",
|
|
118
|
+
"Iraq",
|
|
119
|
+
"Ireland",
|
|
120
|
+
"Isle of Man",
|
|
121
|
+
"Israel",
|
|
122
|
+
"Italy",
|
|
123
|
+
"Jamaica",
|
|
124
|
+
"Japan",
|
|
125
|
+
"Jersey",
|
|
126
|
+
"Jordan",
|
|
127
|
+
"Kazakhstan",
|
|
128
|
+
"Kenya",
|
|
129
|
+
"Kiribati",
|
|
130
|
+
"Korea, Democratic People's Republic of",
|
|
131
|
+
"Korea, Republic of",
|
|
132
|
+
"Kuwait",
|
|
133
|
+
"Kyrgyzstan",
|
|
134
|
+
"Lao People's Democratic Republic",
|
|
135
|
+
"Latvia",
|
|
136
|
+
"Lebanon",
|
|
137
|
+
"Lesotho",
|
|
138
|
+
"Liberia",
|
|
139
|
+
"Libya",
|
|
140
|
+
"Liechtenstein",
|
|
141
|
+
"Lithuania",
|
|
142
|
+
"Luxembourg",
|
|
143
|
+
"Macao",
|
|
144
|
+
"Macedonia, the Former Yugoslav Republic of",
|
|
145
|
+
"Madagascar",
|
|
146
|
+
"Malawi",
|
|
147
|
+
"Malaysia",
|
|
148
|
+
"Maldives",
|
|
149
|
+
"Mali",
|
|
150
|
+
"Malta",
|
|
151
|
+
"Marshall Islands",
|
|
152
|
+
"Martinique",
|
|
153
|
+
"Mauritania",
|
|
154
|
+
"Mauritius",
|
|
155
|
+
"Mayotte",
|
|
156
|
+
"Mexico",
|
|
157
|
+
"Micronesia, Federated States of",
|
|
158
|
+
"Moldova, Republic of",
|
|
159
|
+
"Monaco",
|
|
160
|
+
"Mongolia",
|
|
161
|
+
"Montenegro",
|
|
162
|
+
"Montserrat",
|
|
163
|
+
"Morocco",
|
|
164
|
+
"Mozambique",
|
|
165
|
+
"Myanmar",
|
|
166
|
+
"Namibia",
|
|
167
|
+
"Nauru",
|
|
168
|
+
"Nepal",
|
|
169
|
+
"Netherlands",
|
|
170
|
+
"New Caledonia",
|
|
171
|
+
"New Zealand",
|
|
172
|
+
"Nicaragua",
|
|
173
|
+
"Niger",
|
|
174
|
+
"Nigeria",
|
|
175
|
+
"Niue",
|
|
176
|
+
"Norfolk Island",
|
|
177
|
+
"Northern Mariana Islands",
|
|
178
|
+
"Norway",
|
|
179
|
+
"Oman",
|
|
180
|
+
"Pakistan",
|
|
181
|
+
"Palau",
|
|
182
|
+
"Palestine, State of",
|
|
183
|
+
"Panama",
|
|
184
|
+
"Papua New Guinea",
|
|
185
|
+
"Paraguay",
|
|
186
|
+
"Peru",
|
|
187
|
+
"Philippines",
|
|
188
|
+
"Pitcairn",
|
|
189
|
+
"Poland",
|
|
190
|
+
"Portugal",
|
|
191
|
+
"Puerto Rico",
|
|
192
|
+
"Qatar",
|
|
193
|
+
"Reunion",
|
|
194
|
+
"Romania",
|
|
195
|
+
"Russian Federation",
|
|
196
|
+
"Rwanda",
|
|
197
|
+
"Saint Barthélemy",
|
|
198
|
+
"Saint Helena, Ascension and Tristan da Cunha",
|
|
199
|
+
"Saint Kitts and Nevis",
|
|
200
|
+
"Saint Lucia",
|
|
201
|
+
"Saint Martin (French part)",
|
|
202
|
+
"Saint Pierre and Miquelon",
|
|
203
|
+
"Saint Vincent and the Grenadines",
|
|
204
|
+
"Samoa",
|
|
205
|
+
"San Marino",
|
|
206
|
+
"Sao Tome and Principe",
|
|
207
|
+
"Saudi Arabia",
|
|
208
|
+
"Senegal",
|
|
209
|
+
"Serbia",
|
|
210
|
+
"Seychelles",
|
|
211
|
+
"Sierra Leone",
|
|
212
|
+
"Singapore",
|
|
213
|
+
"Sint Maarten (Dutch part)",
|
|
214
|
+
"Slovakia",
|
|
215
|
+
"Slovenia",
|
|
216
|
+
"Solomon Islands",
|
|
217
|
+
"Somalia",
|
|
218
|
+
"South Africa",
|
|
219
|
+
"South Georgia and the South Sandwich Islands",
|
|
220
|
+
"South Sudan",
|
|
221
|
+
"Spain",
|
|
222
|
+
"Sri Lanka",
|
|
223
|
+
"Sudan",
|
|
224
|
+
"Suriname",
|
|
225
|
+
"Svalbard and Jan Mayen",
|
|
226
|
+
"Swaziland",
|
|
227
|
+
"Sweden",
|
|
228
|
+
"Switzerland",
|
|
229
|
+
"Syrian Arab Republic",
|
|
230
|
+
"Taiwan (Province of China)",
|
|
231
|
+
"Tajikistan",
|
|
232
|
+
"Tanzania, United Republic of",
|
|
233
|
+
"Thailand",
|
|
234
|
+
"Timor-Leste",
|
|
235
|
+
"Togo",
|
|
236
|
+
"Tokelau",
|
|
237
|
+
"Tonga",
|
|
238
|
+
"Trinidad and Tobago",
|
|
239
|
+
"Tunisia",
|
|
240
|
+
"Turkey",
|
|
241
|
+
"Turkmenistan",
|
|
242
|
+
"Turks and Caicos Islands",
|
|
243
|
+
"Tuvalu",
|
|
244
|
+
"Uganda",
|
|
245
|
+
"Ukraine",
|
|
246
|
+
"United Arab Emirates",
|
|
247
|
+
"United Kingdom",
|
|
248
|
+
"United States",
|
|
249
|
+
"United States Minor Outlying Islands",
|
|
250
|
+
"Uruguay",
|
|
251
|
+
"Uzbekistan",
|
|
252
|
+
"Vanuatu",
|
|
253
|
+
"Venezuela",
|
|
254
|
+
"Viet Nam",
|
|
255
|
+
"Virgin Islands (British)",
|
|
256
|
+
"Virgin Islands (U.S.)",
|
|
257
|
+
"Wallis and Futuna",
|
|
258
|
+
"Western Sahara",
|
|
259
|
+
"Yemen",
|
|
260
|
+
"Zambia",
|
|
261
|
+
"Zimbabwe",
|
|
262
|
+
"Åland Islands",
|
|
263
|
+
];
|
|
264
|
+
//# sourceMappingURL=names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"names.js","sourceRoot":"","sources":["../../country/names.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B,aAAa;IACb,SAAS;IACT,SAAS;IACT,gBAAgB;IAChB,SAAS;IACT,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,qBAAqB;IACrB,WAAW;IACX,SAAS;IACT,OAAO;IACP,WAAW;IACX,SAAS;IACT,YAAY;IACZ,SAAS;IACT,SAAS;IACT,YAAY;IACZ,UAAU;IACV,SAAS;IACT,SAAS;IACT,QAAQ;IACR,OAAO;IACP,SAAS;IACT,QAAQ;IACR,SAAS;IACT,kCAAkC;IAClC,wBAAwB;IACxB,UAAU;IACV,eAAe;IACf,QAAQ;IACR,gCAAgC;IAChC,mBAAmB;IACnB,UAAU;IACV,cAAc;IACd,SAAS;IACT,UAAU;IACV,UAAU;IACV,QAAQ;IACR,YAAY;IACZ,gBAAgB;IAChB,0BAA0B;IAC1B,MAAM;IACN,OAAO;IACP,OAAO;IACP,kBAAkB;IAClB,yBAAyB;IACzB,UAAU;IACV,SAAS;IACT,OAAO;IACP,uCAAuC;IACvC,cAAc;IACd,YAAY;IACZ,cAAc;IACd,SAAS;IACT,MAAM;IACN,SAAS;IACT,QAAQ;IACR,gBAAgB;IAChB,SAAS;IACT,UAAU;IACV,UAAU;IACV,oBAAoB;IACpB,SAAS;IACT,OAA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AAQ;IACR,kBAAkB;IAClB,UAAU;IACV,MAAM;IACN,aAAa;IACb,UAAU;IACV,QAAQ;IACR,UAAU;IACV,aAAa;IACb,OAAO;IACP,SAAS;IACT,SAAS;IACT,oBAAoB;IACpB,QAAQ;IACR,kBAAkB;IAClB,8CAA8C;IAC9C,uBAAuB;IACvB,aAAa;IACb,4BAA4B;IAC5B,2BAA2B;IAC3B,kCAAkC;IAClC,OAAO;IACP,YAAY;IACZ,uBAAuB;IACvB,cAAc;IACd,SAAS;IACT,QAAQ;IACR,YAAY;IACZ,cAAc;IACd,WAAW;IACX,2BAA2B;IAC3B,UAAU;IACV,UAAU;IACV,iBAAiB;IACjB,SAAS;IACT,cAAc;IACd,8CAA8C;IAC9C,aAAa;IACb,OAAO;IACP,WAAW;IACX,OAAO;IACP,UAAU;IACV,wBAAwB;IACxB,WAAW;IACX,QAAQ;IACR,aAAa;IACb,sBAAsB;IACtB,4BAA4B;IAC5B,YAAY;IACZ,8BAA8B;IAC9B,UAAU;IACV,aAAa;IACb,MAAM;IACN,SAAS;IACT,OAAO;IACP,qBAAqB;IACrB,SAAS;IACT,QAAQ;IACR,cAAc;IACd,0BAA0B;IAC1B,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,sBAAsB;IACtB,gBAAgB;IAChB,eAAe;IACf,sCAAsC;IACtC,SAAS;IACT,YAAY;IACZ,SAAS;IACT,WAAW;IACX,UAAU;IACV,0BAA0B;IAC1B,uBAAuB;IACvB,mBAAmB;IACnB,gBAAgB;IAChB,OAAO;IACP,QAAQ;IACR,UAAU;IACV,eAAe;CACsB,CAAA"}
|
package/out/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* `candidateSystemsForPostcode` (the inverse of the per-slice postcode patterns) is a top-level
|
|
18
18
|
* export.
|
|
19
19
|
*/
|
|
20
|
+
export { ADDRESS_SYSTEM_CONVENTIONS, type AddressSystemConventions, conventionsForSystem, } from "./address-system-conventions.js";
|
|
20
21
|
export * as ca from "./ca/index.js";
|
|
21
22
|
export * as de from "./de/index.js";
|
|
22
23
|
export * as fr from "./fr/index.js";
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,EAAE,2BAA2B,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACpF,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACN,0BAA0B,EAC1B,KAAK,wBAAwB,EAC7B,oBAAoB,GACpB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,EAAE,2BAA2B,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACpF,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA"}
|
package/out/index.js
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* `candidateSystemsForPostcode` (the inverse of the per-slice postcode patterns) is a top-level
|
|
18
18
|
* export.
|
|
19
19
|
*/
|
|
20
|
+
export { ADDRESS_SYSTEM_CONVENTIONS, conventionsForSystem, } from "./address-system-conventions.js";
|
|
20
21
|
export * as ca from "./ca/index.js";
|
|
21
22
|
export * as de from "./de/index.js";
|
|
22
23
|
export * as fr from "./fr/index.js";
|
package/out/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,EAAE,2BAA2B,EAAmB,MAAM,uBAAuB,CAAA;AACpF,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACN,0BAA0B,EAE1B,oBAAoB,GACpB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,EAAE,2BAA2B,EAAmB,MAAM,uBAAuB,CAAA;AACpF,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA"}
|
package/out/us/index.d.ts
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* The United States address system (USPS): street suffixes, secondary unit designators, ZIP codes,
|
|
7
7
|
* and the state abbreviations they hang off of.
|
|
8
8
|
*/
|
|
9
|
+
export * from "./po-box.js";
|
|
9
10
|
export * from "./state.js";
|
|
11
|
+
export * from "./street-directional.js";
|
|
10
12
|
export * from "./street-suffix.js";
|
|
11
13
|
export * from "./unit-designator.js";
|
|
12
14
|
export * from "./zipcode.js";
|
package/out/us/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../us/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,cAAc,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../us/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,yBAAyB,CAAA;AACvC,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,cAAc,CAAA"}
|
package/out/us/index.js
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* The United States address system (USPS): street suffixes, secondary unit designators, ZIP codes,
|
|
7
7
|
* and the state abbreviations they hang off of.
|
|
8
8
|
*/
|
|
9
|
+
export * from "./po-box.js";
|
|
9
10
|
export * from "./state.js";
|
|
11
|
+
export * from "./street-directional.js";
|
|
10
12
|
export * from "./street-suffix.js";
|
|
11
13
|
export * from "./unit-designator.js";
|
|
12
14
|
export * from "./zipcode.js";
|
package/out/us/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../us/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,cAAc,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../us/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,yBAAyB,CAAA;AACvC,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* USPS PO Box recognition + normalization to the surface forms that actually occur
|
|
7
|
+
* (case-insensitive, punctuated "P.O. Box", spelled-out "Post Office Box", bare "Box"). A PO box
|
|
8
|
+
* isn't a closed vocabulary like street suffixes — it's a designator phrase + a box id — so the
|
|
9
|
+
* API is a detector ({@link isPOBox}), a normalizer ({@link normalizePOBox}), and an extractor
|
|
10
|
+
* ({@link matchPOBox}) the corpus po_box synth/parsing can reuse instead of re-deriving the
|
|
11
|
+
* regex.
|
|
12
|
+
* @see {@link https://pe.usps.com/text/pub28/28c2_012.htm USPS Pub 28 §29 (PO Box / Caller service)}
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* USPS designator phrases that introduce a post-office-box identifier, longest-first so the matcher
|
|
16
|
+
* prefers the most specific phrase ("Post Office Box" before "Box"). Each is matched
|
|
17
|
+
* case-insensitively with flexible internal punctuation/spacing.
|
|
18
|
+
*/
|
|
19
|
+
export declare const US_PO_BOX_DESIGNATORS: readonly ["POST OFFICE BOX", "PO BOX", "P O BOX", "FIRM CALLER", "CALLER", "DRAWER", "LOCKBOX", "BOX"];
|
|
20
|
+
export type UsPoBoxDesignator = (typeof US_PO_BOX_DESIGNATORS)[number];
|
|
21
|
+
/**
|
|
22
|
+
* Type-predicate: does the input look like a standalone PO Box address? Case-insensitive and
|
|
23
|
+
* tolerant of "P.O. Box", "Post Office Box", "Box 12", "PMB"-style ids. (Widens the original
|
|
24
|
+
* isp-nexus `/^PO BOX [\d-]+$/`, which only matched all-caps "PO BOX 123".)
|
|
25
|
+
*/
|
|
26
|
+
export declare function isPOBox(input: unknown): boolean;
|
|
27
|
+
/** Result of a PO-box parse: the matched designator phrase and the box identifier. */
|
|
28
|
+
export interface PoBoxMatch {
|
|
29
|
+
/** The designator phrase as it appeared, e.g. "P.O. Box", "Post Office Box". */
|
|
30
|
+
matched: string;
|
|
31
|
+
/** The box identifier, e.g. "123", "12-A". */
|
|
32
|
+
id: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* If `input` is a PO-box phrase ("PO Box 123", "P.O. Box 12-A", "Post Office Box 7"), return the
|
|
36
|
+
* designator phrase and the id. Null otherwise. Useful for the corpus po_box shard (split the
|
|
37
|
+
* designator from the number) and for resolver/parsing reuse.
|
|
38
|
+
*/
|
|
39
|
+
export declare function matchPOBox(input: unknown): PoBoxMatch | null;
|
|
40
|
+
/**
|
|
41
|
+
* Normalize any recognized PO-box phrase to the canonical USPS "PO BOX <id>" form. Returns the
|
|
42
|
+
* input unchanged if it isn't a PO box. (Widens the original isp-nexus normalizer, which only
|
|
43
|
+
* collapsed the "P.O. BOX" spelling and left the id/casing alone.)
|
|
44
|
+
*/
|
|
45
|
+
export declare function normalizePOBox(input: string): string;
|
|
46
|
+
//# sourceMappingURL=po-box.d.ts.map
|
|
@@ -0,0 +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;AAOtE;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE/C;AAED,sFAAsF;AACtF,MAAM,WAAW,UAAU;IAC1B,gFAAgF;IAChF,OAAO,EAAE,MAAM,CAAA;IACf,8CAA8C;IAC9C,EAAE,EAAE,MAAM,CAAA;CACV;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAO5D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIpD"}
|
package/out/us/po-box.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* USPS PO Box recognition + normalization to the surface forms that actually occur
|
|
7
|
+
* (case-insensitive, punctuated "P.O. Box", spelled-out "Post Office Box", bare "Box"). A PO box
|
|
8
|
+
* isn't a closed vocabulary like street suffixes — it's a designator phrase + a box id — so the
|
|
9
|
+
* API is a detector ({@link isPOBox}), a normalizer ({@link normalizePOBox}), and an extractor
|
|
10
|
+
* ({@link matchPOBox}) the corpus po_box synth/parsing can reuse instead of re-deriving the
|
|
11
|
+
* regex.
|
|
12
|
+
* @see {@link https://pe.usps.com/text/pub28/28c2_012.htm USPS Pub 28 §29 (PO Box / Caller service)}
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* USPS designator phrases that introduce a post-office-box identifier, longest-first so the matcher
|
|
16
|
+
* prefers the most specific phrase ("Post Office Box" before "Box"). Each is matched
|
|
17
|
+
* case-insensitively with flexible internal punctuation/spacing.
|
|
18
|
+
*/
|
|
19
|
+
export const US_PO_BOX_DESIGNATORS = [
|
|
20
|
+
"POST OFFICE BOX",
|
|
21
|
+
"PO BOX",
|
|
22
|
+
"P O BOX",
|
|
23
|
+
"FIRM CALLER",
|
|
24
|
+
"CALLER",
|
|
25
|
+
"DRAWER",
|
|
26
|
+
"LOCKBOX",
|
|
27
|
+
"BOX",
|
|
28
|
+
];
|
|
29
|
+
// Matches a leading PO-box designator + its identifier. Allows "P.O. Box", "PO BOX", "Post Office
|
|
30
|
+
// Box", "Box 12-A", etc. The id is alphanumeric with optional dashes (USPS caller/firm ids exist).
|
|
31
|
+
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
|
+
/**
|
|
33
|
+
* Type-predicate: does the input look like a standalone PO Box address? Case-insensitive and
|
|
34
|
+
* tolerant of "P.O. Box", "Post Office Box", "Box 12", "PMB"-style ids. (Widens the original
|
|
35
|
+
* isp-nexus `/^PO BOX [\d-]+$/`, which only matched all-caps "PO BOX 123".)
|
|
36
|
+
*/
|
|
37
|
+
export function isPOBox(input) {
|
|
38
|
+
return typeof input === "string" && PO_BOX_RE.test(input);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* If `input` is a PO-box phrase ("PO Box 123", "P.O. Box 12-A", "Post Office Box 7"), return the
|
|
42
|
+
* designator phrase and the id. Null otherwise. Useful for the corpus po_box shard (split the
|
|
43
|
+
* designator from the number) and for resolver/parsing reuse.
|
|
44
|
+
*/
|
|
45
|
+
export function matchPOBox(input) {
|
|
46
|
+
if (typeof input !== "string")
|
|
47
|
+
return null;
|
|
48
|
+
const m = PO_BOX_RE.exec(input);
|
|
49
|
+
if (!m)
|
|
50
|
+
return null;
|
|
51
|
+
const matched = (m[1] ?? m[2] ?? m[3] ?? m[4] ?? m[5] ?? m[6] ?? m[7] ?? "").trim();
|
|
52
|
+
const id = m[8];
|
|
53
|
+
return { matched, id };
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Normalize any recognized PO-box phrase to the canonical USPS "PO BOX <id>" form. Returns the
|
|
57
|
+
* input unchanged if it isn't a PO box. (Widens the original isp-nexus normalizer, which only
|
|
58
|
+
* collapsed the "P.O. BOX" spelling and left the id/casing alone.)
|
|
59
|
+
*/
|
|
60
|
+
export function normalizePOBox(input) {
|
|
61
|
+
const m = matchPOBox(input);
|
|
62
|
+
if (!m)
|
|
63
|
+
return input;
|
|
64
|
+
return `PO BOX ${m.id.toUpperCase()}`;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=po-box.js.map
|
|
@@ -0,0 +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,kGAAkG;AAClG,mGAAmG;AACnG,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;AAUD;;;;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;IAC/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,C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