@mailwoman/record 10.1.0 → 10.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/README.md +0 -2
- package/lib/address.ts +22 -27
- package/lib/name.ts +25 -16
- package/lib/organization.ts +5 -13
- package/out/address.d.ts +15 -12
- package/out/address.d.ts.map +1 -1
- package/out/address.js +5 -11
- package/out/address.js.map +1 -1
- package/out/name.d.ts +11 -10
- package/out/name.d.ts.map +1 -1
- package/out/name.js +10 -2
- package/out/name.js.map +1 -1
- package/out/organization.d.ts +3 -3
- package/out/organization.d.ts.map +1 -1
- package/out/organization.js +2 -8
- package/out/organization.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -32,10 +32,8 @@ canonicalizeOrganizationName("Baylor Univ. Med. Ctr.");
|
|
|
32
32
|
```ts
|
|
33
33
|
// Address record (the core of the record system)
|
|
34
34
|
import { PostalAddress, createPostalAddress } from "@mailwoman/record/address"
|
|
35
|
-
|
|
36
35
|
// Person name parsing → structured components
|
|
37
36
|
import { parsePersonName, type ParsedPersonName } from "@mailwoman/record/name"
|
|
38
|
-
|
|
39
37
|
// Organization name canonicalization → matchable key
|
|
40
38
|
import { canonicalizeOrganizationName, type CanonicalizeOrgOpts } from "@mailwoman/record/organization"
|
|
41
39
|
```
|
package/lib/address.ts
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import type { ResolutionTier } from "@mailwoman/annotations/geo"
|
|
8
|
-
import { type
|
|
8
|
+
import { type FormatAddressOptions, formatAddress } from "@mailwoman/codex/address/format"
|
|
9
9
|
import { canonicalKey } from "@mailwoman/codex/address/key"
|
|
10
|
+
import type { ComponentDict } from "@mailwoman/codex/address/render"
|
|
10
11
|
import type { GeoCoordinate } from "@mailwoman/spatial"
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -15,7 +16,7 @@ import type { GeoCoordinate } from "@mailwoman/spatial"
|
|
|
15
16
|
export interface HierarchyNode {
|
|
16
17
|
tag: string
|
|
17
18
|
value: string
|
|
18
|
-
placeID
|
|
19
|
+
placeID: string | null
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
/**
|
|
@@ -35,19 +36,19 @@ export interface AddressGeocode {
|
|
|
35
36
|
/**
|
|
36
37
|
* Lists the resolved admin hierarchy from the locality up to the country.
|
|
37
38
|
*/
|
|
38
|
-
hierarchy
|
|
39
|
+
hierarchy: HierarchyNode[] | null
|
|
39
40
|
|
|
40
41
|
/**
|
|
41
42
|
* Marks a delivery point, such as a PO box, rather than a building,
|
|
42
43
|
* so the coordinate does not locate the addressee.
|
|
43
44
|
*/
|
|
44
|
-
poBox
|
|
45
|
+
poBox: boolean | null
|
|
45
46
|
|
|
46
47
|
/**
|
|
47
48
|
* Marks a multi-unit building whose records share one coordinate,
|
|
48
49
|
* so the coordinate cannot distinguish units.
|
|
49
50
|
*/
|
|
50
|
-
multiUnit
|
|
51
|
+
multiUnit: boolean | null
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
/**
|
|
@@ -70,14 +71,14 @@ export interface PostalAddress {
|
|
|
70
71
|
/**
|
|
71
72
|
* Gives a human-readable single-line form for display.
|
|
72
73
|
*/
|
|
73
|
-
formatted
|
|
74
|
+
formatted: string | null
|
|
74
75
|
|
|
75
|
-
geocode
|
|
76
|
+
geocode: AddressGeocode | null
|
|
76
77
|
|
|
77
78
|
/**
|
|
78
79
|
* Keeps the original free-text input for provenance.
|
|
79
80
|
*/
|
|
80
|
-
raw
|
|
81
|
+
raw: string | null
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
/**
|
|
@@ -86,18 +87,20 @@ export interface PostalAddress {
|
|
|
86
87
|
export interface ToPostalAddressOptions {
|
|
87
88
|
/**
|
|
88
89
|
* Supplies the country for formatting as an ISO-2 code or a name.
|
|
89
|
-
*
|
|
90
|
+
*
|
|
91
|
+
* @defaultValue the `country` component.
|
|
90
92
|
*/
|
|
91
|
-
country?: string
|
|
93
|
+
country?: string | null
|
|
92
94
|
|
|
93
95
|
/**
|
|
94
96
|
* Supplies the original free-text input to keep as provenance.
|
|
95
97
|
*/
|
|
96
|
-
raw?: string
|
|
98
|
+
raw?: string | null
|
|
97
99
|
|
|
98
100
|
/**
|
|
99
101
|
* Indicates whether to compute the `formatted` string.
|
|
100
|
-
*
|
|
102
|
+
*
|
|
103
|
+
* @defaultValue `true`
|
|
101
104
|
*/
|
|
102
105
|
format?: boolean
|
|
103
106
|
|
|
@@ -116,24 +119,16 @@ export interface ToPostalAddressOptions {
|
|
|
116
119
|
export function toPostalAddress(components: ComponentDict, opts: ToPostalAddressOptions = {}): PostalAddress {
|
|
117
120
|
const country = opts.country ?? components.country ?? ""
|
|
118
121
|
|
|
119
|
-
const
|
|
122
|
+
const formatted =
|
|
123
|
+
opts.format === false ? null : formatAddress(components, country, opts.formatOptions ?? { separator: ", " })
|
|
124
|
+
|
|
125
|
+
return {
|
|
120
126
|
components,
|
|
121
127
|
canonicalKey: canonicalKey(components),
|
|
128
|
+
formatted: formatted || null,
|
|
129
|
+
geocode: null,
|
|
130
|
+
raw: opts.raw ?? null,
|
|
122
131
|
}
|
|
123
|
-
|
|
124
|
-
if (opts.raw !== undefined) {
|
|
125
|
-
record.raw = opts.raw
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (opts.format !== false) {
|
|
129
|
-
const formatted = formatAddress(components, country, opts.formatOptions ?? { separator: ", " })
|
|
130
|
-
|
|
131
|
-
if (formatted) {
|
|
132
|
-
record.formatted = formatted
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return record
|
|
137
132
|
}
|
|
138
133
|
|
|
139
134
|
/**
|
package/lib/name.ts
CHANGED
|
@@ -30,37 +30,38 @@ import { TextSpliterator } from "spliterator"
|
|
|
30
30
|
/**
|
|
31
31
|
* A parsed person name.
|
|
32
32
|
*
|
|
33
|
-
*
|
|
33
|
+
* Every field is nullable.
|
|
34
|
+
* The parser fills what it can identify.
|
|
34
35
|
*/
|
|
35
36
|
export interface PersonName {
|
|
36
37
|
/**
|
|
37
38
|
* Title / salutation that preceded the name (`Dr`, `Mr`, `Capt`).
|
|
38
39
|
*/
|
|
39
|
-
prefix
|
|
40
|
+
prefix: string | null
|
|
40
41
|
/**
|
|
41
42
|
* First / given name.
|
|
42
43
|
*/
|
|
43
|
-
given
|
|
44
|
+
given: string | null
|
|
44
45
|
/**
|
|
45
46
|
* Middle name(s) or initial.
|
|
46
47
|
*/
|
|
47
|
-
middle
|
|
48
|
+
middle: string | null
|
|
48
49
|
/**
|
|
49
50
|
* Surname, _without_ any particle (`Vega`, not `de la Vega`).
|
|
50
51
|
*/
|
|
51
|
-
family
|
|
52
|
+
family: string | null
|
|
52
53
|
/**
|
|
53
54
|
* Surname particle, stored separately (`de la`, `van der`, `von`).
|
|
54
55
|
*/
|
|
55
|
-
familyParticle
|
|
56
|
+
familyParticle: string | null
|
|
56
57
|
/**
|
|
57
58
|
* Generational or professional suffix (`Jr`, `III`, `PhD`, `MD`).
|
|
58
59
|
*/
|
|
59
|
-
suffix
|
|
60
|
+
suffix: string | null
|
|
60
61
|
/**
|
|
61
62
|
* A parenthetical or quoted nickname (`"Gob"` in `George "Gob" Bluth`).
|
|
62
63
|
*/
|
|
63
|
-
nickname
|
|
64
|
+
nickname: string | null
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
/**
|
|
@@ -217,10 +218,18 @@ const countChar = (s: string, c: string): number => s.split(c).length - 1
|
|
|
217
218
|
* @returns `null` for empty input.
|
|
218
219
|
* Best-effort and non-throwing — ambiguous input degrades gracefully rather than erroring.
|
|
219
220
|
*/
|
|
220
|
-
export function parsePersonName(input: string | null
|
|
221
|
+
export function parsePersonName(input: string | null): PersonName | null {
|
|
221
222
|
if (!isPresent(input)) return null
|
|
222
223
|
|
|
223
|
-
const result: PersonName = {
|
|
224
|
+
const result: PersonName = {
|
|
225
|
+
prefix: null,
|
|
226
|
+
given: null,
|
|
227
|
+
middle: null,
|
|
228
|
+
family: null,
|
|
229
|
+
familyParticle: null,
|
|
230
|
+
suffix: null,
|
|
231
|
+
nickname: null,
|
|
232
|
+
}
|
|
224
233
|
|
|
225
234
|
// 1. Extract a parenthetical "(Jim)" or quoted "Jim" nickname, then strip it out.
|
|
226
235
|
let working = input
|
|
@@ -256,7 +265,7 @@ export function parsePersonName(input: string | null | undefined): PersonName |
|
|
|
256
265
|
|
|
257
266
|
const tokens = working.split(/\s+/).filter((value) => value.length)
|
|
258
267
|
|
|
259
|
-
if (!tokens.length) return Object.
|
|
268
|
+
if (!tokens.length) return Object.values(result).some((value) => value !== null) ? result : null
|
|
260
269
|
|
|
261
270
|
// 3. Titles at the start become the prefix.
|
|
262
271
|
const prefixParts: string[] = []
|
|
@@ -310,7 +319,7 @@ export function parsePersonName(input: string | null | undefined): PersonName |
|
|
|
310
319
|
const before = tokens.slice(0, particleStart)
|
|
311
320
|
|
|
312
321
|
if (before.length) {
|
|
313
|
-
result.given = before[0]
|
|
322
|
+
result.given = before[0]!
|
|
314
323
|
}
|
|
315
324
|
|
|
316
325
|
if (before.length > 1) {
|
|
@@ -322,13 +331,13 @@ export function parsePersonName(input: string | null | undefined): PersonName |
|
|
|
322
331
|
|
|
323
332
|
// 6. No particle: last token is the surname, first is given, the rest is middle.
|
|
324
333
|
if (tokens.length === 1) {
|
|
325
|
-
result.given = tokens[0]
|
|
334
|
+
result.given = tokens[0]!
|
|
326
335
|
|
|
327
336
|
return result
|
|
328
337
|
}
|
|
329
338
|
|
|
330
|
-
result.given = tokens[0]
|
|
331
|
-
result.family = tokens.at(-1)
|
|
339
|
+
result.given = tokens[0]!
|
|
340
|
+
result.family = tokens.at(-1)!
|
|
332
341
|
|
|
333
342
|
if (tokens.length > 2) {
|
|
334
343
|
result.middle = tokens.slice(1, -1).join(" ")
|
|
@@ -371,7 +380,7 @@ export type PersonNameStyle = "full" | "short"
|
|
|
371
380
|
* The parser stores it separately so the matcher can compare `Vega` independently of `de la`;
|
|
372
381
|
* printing them apart would produce a form absent from the input name.
|
|
373
382
|
*/
|
|
374
|
-
export function formatPersonName(name: PersonName | null
|
|
383
|
+
export function formatPersonName(name: Partial<PersonName> | null, style: PersonNameStyle = "full"): string {
|
|
375
384
|
if (!name) return ""
|
|
376
385
|
|
|
377
386
|
const order = style === "short" ? SHORT_NAME_ORDER : NAME_ORDER
|
package/lib/organization.ts
CHANGED
|
@@ -29,7 +29,7 @@ export interface OrganizationName {
|
|
|
29
29
|
/**
|
|
30
30
|
* The `doing business as` / trade-name clause, canonicalized, when one was present.
|
|
31
31
|
*/
|
|
32
|
-
dba
|
|
32
|
+
dba: string | null
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
@@ -52,7 +52,7 @@ export interface CanonicalizeOptions {
|
|
|
52
52
|
* The comparison ignores case.
|
|
53
53
|
* Unknown codes add no pack.
|
|
54
54
|
*/
|
|
55
|
-
jurisdiction?: string
|
|
55
|
+
jurisdiction?: string | null
|
|
56
56
|
/**
|
|
57
57
|
* Ingest domain that keeps domain-specific abbreviations in organization names.
|
|
58
58
|
*
|
|
@@ -218,7 +218,7 @@ function canonicalizeFragment(
|
|
|
218
218
|
* between jurisdiction and domain rules.
|
|
219
219
|
*/
|
|
220
220
|
export function canonicalizeOrganizationName(
|
|
221
|
-
input: string | null
|
|
221
|
+
input: string | null,
|
|
222
222
|
options?: CanonicalizeOptions
|
|
223
223
|
): OrganizationName | null {
|
|
224
224
|
if (typeof input !== "string" || !input.trim()) return null
|
|
@@ -229,15 +229,7 @@ export function canonicalizeOrganizationName(
|
|
|
229
229
|
|
|
230
230
|
const { canonical, designations } = canonicalizeFragment(legalPart ?? "", designationSet)
|
|
231
231
|
|
|
232
|
-
const
|
|
232
|
+
const dba = dbaParts.length ? canonicalizeFragment(dbaParts.join(" "), designationSet).canonical : null
|
|
233
233
|
|
|
234
|
-
|
|
235
|
-
const dba = canonicalizeFragment(dbaParts.join(" "), designationSet).canonical
|
|
236
|
-
|
|
237
|
-
if (dba) {
|
|
238
|
-
result.dba = dba
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
return result
|
|
234
|
+
return { raw, canonical, designations, dba: dba || null }
|
|
243
235
|
}
|
package/out/address.d.ts
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*/
|
|
6
6
|
import type { ResolutionTier } from "@mailwoman/annotations/geo";
|
|
7
|
-
import { type
|
|
7
|
+
import { type FormatAddressOptions } from "@mailwoman/codex/address/format";
|
|
8
|
+
import type { ComponentDict } from "@mailwoman/codex/address/render";
|
|
8
9
|
import type { GeoCoordinate } from "@mailwoman/spatial";
|
|
9
10
|
/**
|
|
10
11
|
* One resolved admin-hierarchy ancestor (most specific first), for spelling-invariant blocking.
|
|
@@ -12,7 +13,7 @@ import type { GeoCoordinate } from "@mailwoman/spatial";
|
|
|
12
13
|
export interface HierarchyNode {
|
|
13
14
|
tag: string;
|
|
14
15
|
value: string;
|
|
15
|
-
placeID
|
|
16
|
+
placeID: string | null;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* A resolved geocode attached to an address record — the location signal the matcher scores on.
|
|
@@ -29,17 +30,17 @@ export interface AddressGeocode {
|
|
|
29
30
|
/**
|
|
30
31
|
* Lists the resolved admin hierarchy from the locality up to the country.
|
|
31
32
|
*/
|
|
32
|
-
hierarchy
|
|
33
|
+
hierarchy: HierarchyNode[] | null;
|
|
33
34
|
/**
|
|
34
35
|
* Marks a delivery point, such as a PO box, rather than a building,
|
|
35
36
|
* so the coordinate does not locate the addressee.
|
|
36
37
|
*/
|
|
37
|
-
poBox
|
|
38
|
+
poBox: boolean | null;
|
|
38
39
|
/**
|
|
39
40
|
* Marks a multi-unit building whose records share one coordinate,
|
|
40
41
|
* so the coordinate cannot distinguish units.
|
|
41
42
|
*/
|
|
42
|
-
multiUnit
|
|
43
|
+
multiUnit: boolean | null;
|
|
43
44
|
}
|
|
44
45
|
/**
|
|
45
46
|
* Describes the canonical address record with parsed components plus a match key.
|
|
@@ -59,12 +60,12 @@ export interface PostalAddress {
|
|
|
59
60
|
/**
|
|
60
61
|
* Gives a human-readable single-line form for display.
|
|
61
62
|
*/
|
|
62
|
-
formatted
|
|
63
|
-
geocode
|
|
63
|
+
formatted: string | null;
|
|
64
|
+
geocode: AddressGeocode | null;
|
|
64
65
|
/**
|
|
65
66
|
* Keeps the original free-text input for provenance.
|
|
66
67
|
*/
|
|
67
|
-
raw
|
|
68
|
+
raw: string | null;
|
|
68
69
|
}
|
|
69
70
|
/**
|
|
70
71
|
* Options for {@linkcode toPostalAddress}.
|
|
@@ -72,16 +73,18 @@ export interface PostalAddress {
|
|
|
72
73
|
export interface ToPostalAddressOptions {
|
|
73
74
|
/**
|
|
74
75
|
* Supplies the country for formatting as an ISO-2 code or a name.
|
|
75
|
-
*
|
|
76
|
+
*
|
|
77
|
+
* @defaultValue the `country` component.
|
|
76
78
|
*/
|
|
77
|
-
country?: string;
|
|
79
|
+
country?: string | null;
|
|
78
80
|
/**
|
|
79
81
|
* Supplies the original free-text input to keep as provenance.
|
|
80
82
|
*/
|
|
81
|
-
raw?: string;
|
|
83
|
+
raw?: string | null;
|
|
82
84
|
/**
|
|
83
85
|
* Indicates whether to compute the `formatted` string.
|
|
84
|
-
*
|
|
86
|
+
*
|
|
87
|
+
* @defaultValue `true`
|
|
85
88
|
*/
|
|
86
89
|
format?: boolean;
|
|
87
90
|
/**
|
package/out/address.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../lib/address.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../lib/address.ts"],"names":[],"mappings":"AAAA;;;;GAIG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a,CAAC,EAAE,oBAAoB,CAAA;CACpC;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,aAAa,EAAE,IAAI,GAAE,sBAA2B,GAAG,aAAa,CAa3G;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,GAAG,aAAa,CAEzF"}
|
package/out/address.js
CHANGED
|
@@ -13,20 +13,14 @@ import { canonicalKey } from "@mailwoman/codex/address/key";
|
|
|
13
13
|
*/
|
|
14
14
|
export function toPostalAddress(components, opts = {}) {
|
|
15
15
|
const country = opts.country ?? components.country ?? "";
|
|
16
|
-
const
|
|
16
|
+
const formatted = opts.format === false ? null : formatAddress(components, country, opts.formatOptions ?? { separator: ", " });
|
|
17
|
+
return {
|
|
17
18
|
components,
|
|
18
19
|
canonicalKey: canonicalKey(components),
|
|
20
|
+
formatted: formatted || null,
|
|
21
|
+
geocode: null,
|
|
22
|
+
raw: opts.raw ?? null,
|
|
19
23
|
};
|
|
20
|
-
if (opts.raw !== undefined) {
|
|
21
|
-
record.raw = opts.raw;
|
|
22
|
-
}
|
|
23
|
-
if (opts.format !== false) {
|
|
24
|
-
const formatted = formatAddress(components, country, opts.formatOptions ?? { separator: ", " });
|
|
25
|
-
if (formatted) {
|
|
26
|
-
record.formatted = formatted;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return record;
|
|
30
24
|
}
|
|
31
25
|
/**
|
|
32
26
|
* Attach (or replace) a resolved geocode on an address record, returning a new record.
|
package/out/address.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.js","sourceRoot":"","sources":["../lib/address.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"address.js","sourceRoot":"","sources":["../lib/address.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAA6B,aAAa,EAAE,MAAM,iCAAiC,CAAA;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAwG3D;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,UAAyB,EAAE,IAAI,GAA2B,EAAE;IAC3F,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,UAAU,CAAC,OAAO,IAAI,EAAE,CAAA;IAExD,MAAM,SAAS,GACd,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,aAAa,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IAE7G,OAAO;QACN,UAAU;QACV,YAAY,EAAE,YAAY,CAAC,UAAU,CAAC;QACtC,SAAS,EAAE,SAAS,IAAI,IAAI;QAC5B,OAAO,EAAE,IAAI;QACb,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,IAAI;KACrB,CAAA;AACF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,MAAqB,EAAE,OAAuB;IACzE,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAA;AAC9B,CAAC"}
|
package/out/name.d.ts
CHANGED
|
@@ -27,37 +27,38 @@
|
|
|
27
27
|
/**
|
|
28
28
|
* A parsed person name.
|
|
29
29
|
*
|
|
30
|
-
*
|
|
30
|
+
* Every field is nullable.
|
|
31
|
+
* The parser fills what it can identify.
|
|
31
32
|
*/
|
|
32
33
|
export interface PersonName {
|
|
33
34
|
/**
|
|
34
35
|
* Title / salutation that preceded the name (`Dr`, `Mr`, `Capt`).
|
|
35
36
|
*/
|
|
36
|
-
prefix
|
|
37
|
+
prefix: string | null;
|
|
37
38
|
/**
|
|
38
39
|
* First / given name.
|
|
39
40
|
*/
|
|
40
|
-
given
|
|
41
|
+
given: string | null;
|
|
41
42
|
/**
|
|
42
43
|
* Middle name(s) or initial.
|
|
43
44
|
*/
|
|
44
|
-
middle
|
|
45
|
+
middle: string | null;
|
|
45
46
|
/**
|
|
46
47
|
* Surname, _without_ any particle (`Vega`, not `de la Vega`).
|
|
47
48
|
*/
|
|
48
|
-
family
|
|
49
|
+
family: string | null;
|
|
49
50
|
/**
|
|
50
51
|
* Surname particle, stored separately (`de la`, `van der`, `von`).
|
|
51
52
|
*/
|
|
52
|
-
familyParticle
|
|
53
|
+
familyParticle: string | null;
|
|
53
54
|
/**
|
|
54
55
|
* Generational or professional suffix (`Jr`, `III`, `PhD`, `MD`).
|
|
55
56
|
*/
|
|
56
|
-
suffix
|
|
57
|
+
suffix: string | null;
|
|
57
58
|
/**
|
|
58
59
|
* A parenthetical or quoted nickname (`"Gob"` in `George "Gob" Bluth`).
|
|
59
60
|
*/
|
|
60
|
-
nickname
|
|
61
|
+
nickname: string | null;
|
|
61
62
|
}
|
|
62
63
|
/**
|
|
63
64
|
* Parse a full name into components.
|
|
@@ -65,7 +66,7 @@ export interface PersonName {
|
|
|
65
66
|
* @returns `null` for empty input.
|
|
66
67
|
* Best-effort and non-throwing — ambiguous input degrades gracefully rather than erroring.
|
|
67
68
|
*/
|
|
68
|
-
export declare function parsePersonName(input: string | null
|
|
69
|
+
export declare function parsePersonName(input: string | null): PersonName | null;
|
|
69
70
|
/**
|
|
70
71
|
* How much of the name to print.
|
|
71
72
|
*/
|
|
@@ -83,5 +84,5 @@ export type PersonNameStyle = "full" | "short";
|
|
|
83
84
|
* The parser stores it separately so the matcher can compare `Vega` independently of `de la`;
|
|
84
85
|
* printing them apart would produce a form absent from the input name.
|
|
85
86
|
*/
|
|
86
|
-
export declare function formatPersonName(name: PersonName | null
|
|
87
|
+
export declare function formatPersonName(name: Partial<PersonName> | null, style?: PersonNameStyle): string;
|
|
87
88
|
//# sourceMappingURL=name.d.ts.map
|
package/out/name.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"name.d.ts","sourceRoot":"","sources":["../lib/name.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH
|
|
1
|
+
{"version":3,"file":"name.d.ts","sourceRoot":"","sources":["../lib/name.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IAC1B;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB;;OAEG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB;AAsJD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,UAAU,GAAG,IAAI,CA8HvE;AAkBD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAA;AAE9C;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,EAAE,KAAK,GAAE,eAAwB,GAAG,MAAM,CAe1G"}
|
package/out/name.js
CHANGED
|
@@ -152,7 +152,15 @@ const countChar = (s, c) => s.split(c).length - 1;
|
|
|
152
152
|
export function parsePersonName(input) {
|
|
153
153
|
if (!isPresent(input))
|
|
154
154
|
return null;
|
|
155
|
-
const result = {
|
|
155
|
+
const result = {
|
|
156
|
+
prefix: null,
|
|
157
|
+
given: null,
|
|
158
|
+
middle: null,
|
|
159
|
+
family: null,
|
|
160
|
+
familyParticle: null,
|
|
161
|
+
suffix: null,
|
|
162
|
+
nickname: null,
|
|
163
|
+
};
|
|
156
164
|
// 1. Extract a parenthetical "(Jim)" or quoted "Jim" nickname, then strip it out.
|
|
157
165
|
let working = input
|
|
158
166
|
.replaceAll(/\s*\(([^)]+)\)\s*/g, (_m, n) => {
|
|
@@ -183,7 +191,7 @@ export function parsePersonName(input) {
|
|
|
183
191
|
}
|
|
184
192
|
const tokens = working.split(/\s+/).filter((value) => value.length);
|
|
185
193
|
if (!tokens.length)
|
|
186
|
-
return Object.
|
|
194
|
+
return Object.values(result).some((value) => value !== null) ? result : null;
|
|
187
195
|
// 3. Titles at the start become the prefix.
|
|
188
196
|
const prefixParts = [];
|
|
189
197
|
while (tokens.length > 1 && TITLES.has(norm(tokens[0]))) {
|
package/out/name.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"name.js","sourceRoot":"","sources":["../lib/name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"name.js","sourceRoot":"","sources":["../lib/name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAkE7C;;;;GAIG;AACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC;IACtB,QAAQ;IACR,IAAI;IACJ,MAAM;IACN,WAAW;IACX,MAAM;IACN,SAAS;IACT,MAAM;IACN,KAAK;IACL,SAAS;IACT,WAAW;IACX,cAAc;IACd,KAAK;IACL,KAAK;IACL,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,IAAI;IACJ,QAAQ;IACR,IAAI;IACJ,KAAK;IACL,SAAS;IACT,KAAK;IACL,WAAW;IACX,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,KAAK;IACL,OAAO;IACP,QAAQ;IACR,MAAM;IACN,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,QAAQ;IACR,KAAK;IACL,MAAM;IACN,WAAW;IACX,SAAS;IACT,MAAM;IACN,W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A;IAC9C,CAAC;IAED,OAAO,MAAM,CAAA;AACd,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,GAAkC,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;AAErH;;;;GAIG;AACH,MAAM,gBAAgB,GAAkC,CAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAA;AAO7F;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAgC,EAAE,KAAK,GAAoB,MAAM;IACjG,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAA;IAEpB,MAAM,KAAK,GAAG,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,UAAU,CAAA;IAC/D,MAAM,KAAK,GAAa,EAAE,CAAA;IAE1B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAA;QAEhC,IAAI,KAAK,EAAE,CAAC;YACX,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAClB,CAAC;IACF,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACvB,CAAC"}
|
package/out/organization.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export interface OrganizationName {
|
|
|
26
26
|
/**
|
|
27
27
|
* The `doing business as` / trade-name clause, canonicalized, when one was present.
|
|
28
28
|
*/
|
|
29
|
-
dba
|
|
29
|
+
dba: string | null;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Names a domain pack.
|
|
@@ -47,7 +47,7 @@ export interface CanonicalizeOptions {
|
|
|
47
47
|
* The comparison ignores case.
|
|
48
48
|
* Unknown codes add no pack.
|
|
49
49
|
*/
|
|
50
|
-
jurisdiction?: string;
|
|
50
|
+
jurisdiction?: string | null;
|
|
51
51
|
/**
|
|
52
52
|
* Ingest domain that keeps domain-specific abbreviations in organization names.
|
|
53
53
|
*
|
|
@@ -64,5 +64,5 @@ export interface CanonicalizeOptions {
|
|
|
64
64
|
* Returns `null` for empty input. {@link CanonicalizeOptions} resolves conflicts
|
|
65
65
|
* between jurisdiction and domain rules.
|
|
66
66
|
*/
|
|
67
|
-
export declare function canonicalizeOrganizationName(input: string | null
|
|
67
|
+
export declare function canonicalizeOrganizationName(input: string | null, options?: CanonicalizeOptions): OrganizationName | null;
|
|
68
68
|
//# sourceMappingURL=organization.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../lib/organization.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB;;OAEG;IACH,GAAG,
|
|
1
|
+
{"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../lib/organization.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB;;OAEG;IACH,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAClB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,YAAY,CAAA;AAExD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAA;CAC1B;AAqJD;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC3C,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,OAAO,CAAC,EAAE,mBAAmB,GAC3B,gBAAgB,GAAG,IAAI,CAYzB"}
|
package/out/organization.js
CHANGED
|
@@ -154,13 +154,7 @@ export function canonicalizeOrganizationName(input, options) {
|
|
|
154
154
|
const designationSet = resolveDesignations(options);
|
|
155
155
|
const [legalPart, ...dbaParts] = input.split(DBA_PATTERN);
|
|
156
156
|
const { canonical, designations } = canonicalizeFragment(legalPart ?? "", designationSet);
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
const dba = canonicalizeFragment(dbaParts.join(" "), designationSet).canonical;
|
|
160
|
-
if (dba) {
|
|
161
|
-
result.dba = dba;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return result;
|
|
157
|
+
const dba = dbaParts.length ? canonicalizeFragment(dbaParts.join(" "), designationSet).canonical : null;
|
|
158
|
+
return { raw, canonical, designations, dba: dba || null };
|
|
165
159
|
}
|
|
166
160
|
//# sourceMappingURL=organization.js.map
|
package/out/organization.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization.js","sourceRoot":"","sources":["../lib/organization.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AAuDzD;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IACjC,KAAK;IACL,cAAc;IACd,MAAM;IACN,aAAa;IACb,IAAI;IACJ,SAAS;IACT,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,IAAI;IACJ,KAAK;IACL,SAAS;IACT,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,MAAM;IACN,IAAI;IACJ,MAAM;IACN,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAA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CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,YAAY,EAAE,CAAA;AACnD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,4BAA4B,CAC3C,
|
|
1
|
+
{"version":3,"file":"organization.js","sourceRoot":"","sources":["../lib/organization.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AAuDzD;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IACjC,KAAK;IACL,cAAc;IACd,MAAM;IACN,aAAa;IACb,IAAI;IACJ,SAAS;IACT,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,IAAI;IACJ,KAAK;IACL,SAAS;IACT,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,MAAM;IACN,IAAI;IACJ,MAAM;IACN,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,KAAK;IACL,KAAK;IACL,IAAI;IACJ,MAAM;IACN,IAAI;IACJ,KAAK;IACL,aAAa;IACb,KAAK;IACL,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,uEAAuE;IACvE,MAAM;IACN,MAAM;CACN,CAAC,CAAA;AAEF;;;GAGG;AACH,MAAM,yBAAyB,GAAsC;IACpE,EAAE,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,uDAAuD;IAChF,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC;IAChD,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;IAClB,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,C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AAC,IAAI,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAA;IAEvG,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,IAAI,IAAI,EAAE,CAAA;AAC1D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/record",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.0",
|
|
4
4
|
"description": "Lean, plain-TypeScript record schema + per-field normalizers for the geocode-first matcher. Address-first: the canonical PostalAddress record composes parser components, the formatter's match key, and a resolved geocode; organization + contact records build on the same canonical record.",
|
|
5
5
|
"license": "AGPL-3.0-only OR LicenseRef-Commercial",
|
|
6
6
|
"repository": {
|
|
@@ -64,12 +64,12 @@
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@mailwoman/annotations": "10.
|
|
68
|
-
"@mailwoman/codex": "10.
|
|
69
|
-
"@mailwoman/spatial": "10.
|
|
70
|
-
"spliterator": "^
|
|
67
|
+
"@mailwoman/annotations": "10.2.0",
|
|
68
|
+
"@mailwoman/codex": "10.2.0",
|
|
69
|
+
"@mailwoman/spatial": "10.2.0",
|
|
70
|
+
"spliterator": "^9.2.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@types/node": "^26.4
|
|
73
|
+
"@types/node": "^26.6.4"
|
|
74
74
|
}
|
|
75
75
|
}
|