@pubid/pubid 0.1.72 → 0.1.73

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 CHANGED
@@ -137,14 +137,32 @@ parseOk("garbage", "iso"); // false — rejections raise ParseError
137
137
 
138
138
  The lane keys: `dated` (the norm — the canonical uppercased and
139
139
  de-spaced), `undated` (every colon-year not followed by a dash is gone,
140
- base and supplement alike) and `all_parts` (the parsed part stripped —
141
- structurally only, never by guessing). The derivation helpers
142
- `norm` / `undatedNorm` / `allPartsNorm` compose into them and are
143
- exported individually. The flavor must be named: grammar-ported flavors
140
+ base and supplement alike) and `all_parts` (the parsed part, with its
141
+ subpart, stripped — structurally only, never into a longer number, never
142
+ by guessing: `IEC 60601-1-10:2013/AMD1:2016` gives `IEC60601/AMD1`). The
143
+ derivation helpers `norm` / `undatedNorm` / `allPartsNorm` /
144
+ `structuralPart` / `laneKeysFrom` compose into them and are exported
145
+ individually. The flavor must be named: grammar-ported flavors
144
146
  parse open-endedly; the rest resolve over the bundled corpus. `parse`
145
147
  raises `ParseError` (with `input`, `flavor` and the wrapped engine
146
148
  `cause`) on every rejection.
147
149
 
150
+ ### Lane keys in a worker
151
+
152
+ `dist/lane-keys.js` imports nothing, so a Cloudflare Worker with no
153
+ `nodejs_compat` can import it. `laneKeysOf(id)` is
154
+ `laneKeysFrom(id.toHuman(), id.toHash())`: apply it to the identifier
155
+ that a worker flavor entry returns.
156
+
157
+ ```ts
158
+ import { laneKeysOf } from "@pubid/pubid/dist/lane-keys.js";
159
+ import { iecWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/iec/worker.js";
160
+
161
+ laneKeysOf(iecWorkerGrammarImplementation().parse("IEC 60601-1-10:2013/AMD1:2016"));
162
+ // { dated: "IEC60601-1-10:2013/AMD1:2016", undated: "IEC60601-1-10/AMD1",
163
+ // all_parts: "IEC60601/AMD1" }
164
+ ```
165
+
148
166
  ## Worker-safe registration: the pubid-scheme URN codec
149
167
 
150
168
  The package root (and the grammar barrel `dist/flavors/index.js` it
Binary file
@@ -896,13 +896,20 @@ function ieeeClass(spec, opts = {}) {
896
896
  ? base
897
897
  : base.filter((m) => !opts.wireDelete.keys.includes(m.wire));
898
898
  }
899
- // The UNFILTERED list: nested serialization keeps the derived keys
900
- // the top-level wire deletes (mirrors lutaml's nested transform,
901
- // which serializes through the reader methods).
899
+ // The NESTED list: the derived-key deletes are nested-safe since the
900
+ // reference's compact_hash twins (gem#806) — a class carrying
901
+ // nestedWireDelete drops the same keys on the nested path, so the
902
+ // nested base hash matches the top-level wire. Classes without a
903
+ // compact_hash twin (the supplement family, multi-numbered) keep the
904
+ // unfiltered list — the reference's nested transform still emits the
905
+ // derived keys for them.
902
906
  static get mappingsNested() {
903
- return opts.extraMappings === undefined
907
+ const base = opts.extraMappings === undefined
904
908
  ? parentMappings()
905
909
  : [...parentMappings(), ...opts.extraMappings];
910
+ return opts.nestedWireDelete === undefined
911
+ ? base
912
+ : base.filter((m) => !opts.nestedWireDelete.keys.includes(m.wire));
906
913
  }
907
914
  constructor(attrs = {}) {
908
915
  super(attrs);
@@ -1117,6 +1124,7 @@ export const DualPublishedClass = ieeeClass({ kind: "dual-published" }, {
1117
1124
  extraDefs: DualDefs,
1118
1125
  extraMappings: keyValue(nestedIdWire("first_identifier"), nestedIdWire("second_identifier")),
1119
1126
  wireDelete: { keys: ["publisher"] },
1127
+ nestedWireDelete: { keys: ["publisher"] },
1120
1128
  render: (id) => `${id["first_identifier"].toHuman()} and ${id["second_identifier"].toHuman()}`,
1121
1129
  rootOf: childOf("first_identifier"),
1122
1130
  yearForUrnOf: childYearOf("first_identifier"),
@@ -1148,6 +1156,7 @@ export const AdoptedStandardClass = ieeeClass({ kind: "adopted-standard" }, {
1148
1156
  },
1149
1157
  extraMappings: keyValue(nestedIdWire("ieee_identifier"), nestedIdWire("adopted_identifiers")),
1150
1158
  wireDelete: { keys: ["publisher"] },
1159
+ nestedWireDelete: { keys: ["publisher"] },
1151
1160
  render: (id) => {
1152
1161
  const ieee = id["ieee_identifier"];
1153
1162
  let result = ieee.toHuman();
@@ -1211,6 +1220,7 @@ export const JointDevelopmentClass = ieeeClass({ kind: "joint-development" }, {
1211
1220
  },
1212
1221
  extraMappings: keyValue({ wire: "publishers", to: "publishers" }, { wire: "lead_party", to: "lead_party" }, { wire: "iso_stage", to: "iso_stage" }, { wire: "ieee_draft", to: "ieee_draft" }, { wire: "parenthetical_content", to: "parenthetical_content" }, { wire: "draft_status", to: "draft_status" }),
1213
1222
  wireDelete: { keys: ["publisher", "copublisher"] },
1223
+ nestedWireDelete: { keys: ["publisher", "copublisher"] },
1214
1224
  render: (id) => {
1215
1225
  const publishers = id["publishers"];
1216
1226
  const leadParty = id["lead_party"];
@@ -409,6 +409,7 @@ export function preprocessIeee(input) {
409
409
  cleaned = cleaned.replace(/(IEC\s+\d+(?:-\d+)?(?::\d{4})?(?:\s+(?:First\s+)?[Ee]dition\s+\d+(?:\.\d+)?\s+\d{4}-\d{2})?)\s+(IEEE\s+Std\s+\S+|IEEE\s+\S+)/g, "$1; $2");
410
410
  cleaned = cleaned.replace(/^(IEC\s+\d+(?:-\d+)?):\d{4}(\s+(?:First\s+)?[Ee]dition\s+\d+(?:\.\d+)?\s+\d{4}-\d{2})/, "$1$2");
411
411
  cleaned = cleaned.replaceAll("™", "");
412
+ cleaned = cleaned.replaceAll("®", "");
412
413
  cleaned = cleaned.replace(/\b19969\b/g, "1969");
413
414
  cleaned = cleaned.replace(/(\d{4}),(\d{3})/g, "$1, $2");
414
415
  cleaned = cleaned.replaceAll("/lNT", "/INT");
package/dist/index.d.ts CHANGED
@@ -8,6 +8,6 @@ export { checkCase, runFlavor, runCorpus } from "./conformance/runner.js";
8
8
  export { corpusModeImplementation, CorpusBackedIdentifier } from "./implementations/corpus-mode.js";
9
9
  export { grammarImplementation } from "./flavors/index.js";
10
10
  export { subsetMatch, valueMatch, exactMatch } from "./model/subset-match.js";
11
- export { parse, parseOk, render, laneKeys, norm, undatedNorm, allPartsNorm, ParseError, } from "./parse-surface.js";
12
- export type { ParseResult, LaneKeys } from "./parse-surface.js";
11
+ export { parse, parseOk, render, laneKeys, norm, undatedNorm, allPartsNorm, structuralPart, laneKeysFrom, laneKeysOf, ParseError, } from "./parse-surface.js";
12
+ export type { ParseResult, LaneKeys, LaneKeySource } from "./parse-surface.js";
13
13
  export * as PubidUrn from "./pubid-urn/index.js";
package/dist/index.js CHANGED
@@ -10,6 +10,6 @@ export { grammarImplementation } from "./flavors/index.js";
10
10
  export { subsetMatch, valueMatch, exactMatch } from "./model/subset-match.js";
11
11
  // The parse surface: structured components, canonical render, the lane
12
12
  // keys and the parse_ok verdict (pubid/pubid-ts#226).
13
- export { parse, parseOk, render, laneKeys, norm, undatedNorm, allPartsNorm, ParseError, } from "./parse-surface.js";
13
+ export { parse, parseOk, render, laneKeys, norm, undatedNorm, allPartsNorm, structuralPart, laneKeysFrom, laneKeysOf, ParseError, } from "./parse-surface.js";
14
14
  // The pubid-scheme URN codec and the slug form (pubid-ts#161).
15
15
  export * as PubidUrn from "./pubid-urn/index.js";
@@ -0,0 +1,68 @@
1
+ /**
2
+ * The lane keys (relaton/relaton-api-js#188): the `dated` / `undated` /
3
+ * `all_parts` normalized keys that the corpus lanes and the consumers
4
+ * index by. This module imports nothing, so a Cloudflare worker (no
5
+ * `nodejs_compat`) can import `@pubid/pubid/dist/lane-keys.js` and derive
6
+ * the keys from any identifier that a worker flavor entry returns.
7
+ *
8
+ * `norm` uppercases the canonical render and deletes spaces; `undated`
9
+ * strips every colon-year not followed by a dash; `all_parts`
10
+ * additionally strips the parsed part (with its subpart) — structurally,
11
+ * never by guessing: a trailing "-05" that pubid did not parse as a part
12
+ * is a date day, not a part, and stays.
13
+ */
14
+ /** The lane keys of one identifier: the lookup lanes the corpus and the
15
+ * consumers index by. */
16
+ export interface LaneKeys {
17
+ /** The dated lane: the normalized canonical (uppercased, de-spaced). */
18
+ dated: string;
19
+ /** The undated lane: every colon-year not followed by a dash is gone
20
+ * (base and supplement alike — one rule, no per-flavor casing). */
21
+ undated: string;
22
+ /** The all-parts lane: the parsed part (and subpart) stripped from the
23
+ * undated lane. Structural only — an unparsed trailing "-N" is never a
24
+ * part. */
25
+ all_parts: string;
26
+ }
27
+ /** The surface of a parsed identifier that the lane keys read. */
28
+ export interface LaneKeySource {
29
+ /** The canonical human render. */
30
+ toHuman(): string;
31
+ /** The canonical component record (the wire shape). */
32
+ toHash(): Record<string, unknown>;
33
+ }
34
+ /**
35
+ * The dated lane: the canonical render uppercased and de-spaced. Ruby's
36
+ * `canonical.upcase.delete(" ")` — exactly the space character is
37
+ * deleted, not every whitespace run.
38
+ */
39
+ export declare function norm(canonical: string): string;
40
+ /**
41
+ * The undated lane from a norm key: every `:?`-year not followed by a
42
+ * dash is stripped — globally, base and supplement years alike. Ruby's
43
+ * `gsub(/:?(?:19|20)\d{2}(?=[^-]*$)/, "")` verbatim.
44
+ */
45
+ export declare function undatedNorm(normKey: string): string;
46
+ /**
47
+ * The all-parts lane from an undated key: the first `-<part>-<subpart>`
48
+ * (when a subpart is given), else the first `-<part>`, that is not
49
+ * followed by a dash is stripped. A segment that ends in a digit never
50
+ * continues into a digit, so part `1` does not match the start of `-10`;
51
+ * a letter suffix that norm glued on (`ED1`, `RLV`) does not block the
52
+ * strip. A blank part strips nothing.
53
+ */
54
+ export declare function allPartsNorm(undated: string, part?: string, subpart?: string): string;
55
+ /**
56
+ * The structural part of a canonical component record: the identifier's
57
+ * own `part` facet, else the base's (Ruby's `id.part || id.base&.part`).
58
+ * A part facet is either a string or a typed record carrying `value`
59
+ * (the NIST lettered parts); anything else is no part.
60
+ */
61
+ export declare function structuralPart(components: Record<string, unknown>): string | undefined;
62
+ /** The lane keys for an already-canonical record: norm from the render,
63
+ * undated from the norm, all_parts from the parsed part and subpart. */
64
+ export declare function laneKeysFrom(canonical: string, components: Record<string, unknown>): LaneKeys;
65
+ /** The lane keys of a parsed identifier: `laneKeysFrom(id.toHuman(),
66
+ * id.toHash())`. Use it on the identifier that a worker flavor entry
67
+ * (`dist/flavors/<flavor>/worker.js`) returns. */
68
+ export declare function laneKeysOf(identifier: LaneKeySource): LaneKeys;
@@ -0,0 +1,113 @@
1
+ /**
2
+ * The lane keys (relaton/relaton-api-js#188): the `dated` / `undated` /
3
+ * `all_parts` normalized keys that the corpus lanes and the consumers
4
+ * index by. This module imports nothing, so a Cloudflare worker (no
5
+ * `nodejs_compat`) can import `@pubid/pubid/dist/lane-keys.js` and derive
6
+ * the keys from any identifier that a worker flavor entry returns.
7
+ *
8
+ * `norm` uppercases the canonical render and deletes spaces; `undated`
9
+ * strips every colon-year not followed by a dash; `all_parts`
10
+ * additionally strips the parsed part (with its subpart) — structurally,
11
+ * never by guessing: a trailing "-05" that pubid did not parse as a part
12
+ * is a date day, not a part, and stays.
13
+ */
14
+ /** Ruby Regexp.escape, for the all-parts strip of an arbitrary part. */
15
+ function escapeRegExp(text) {
16
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
17
+ }
18
+ /**
19
+ * The dated lane: the canonical render uppercased and de-spaced. Ruby's
20
+ * `canonical.upcase.delete(" ")` — exactly the space character is
21
+ * deleted, not every whitespace run.
22
+ */
23
+ export function norm(canonical) {
24
+ return canonical.toUpperCase().replaceAll(" ", "");
25
+ }
26
+ /**
27
+ * The undated lane from a norm key: every `:?`-year not followed by a
28
+ * dash is stripped — globally, base and supplement years alike. Ruby's
29
+ * `gsub(/:?(?:19|20)\d{2}(?=[^-]*$)/, "")` verbatim.
30
+ */
31
+ export function undatedNorm(normKey) {
32
+ return normKey.replace(/:?(?:19|20)\d{2}(?=[^-]*$)/g, "");
33
+ }
34
+ function stripTrailingSegment(undated, segment) {
35
+ const digitBoundary = /[0-9]$/.test(segment) ? "(?![0-9])" : "";
36
+ const pattern = new RegExp(`-${escapeRegExp(segment.toUpperCase())}${digitBoundary}(?=[^-]*$)`);
37
+ return pattern.test(undated) ? undated.replace(pattern, "") : undefined;
38
+ }
39
+ /**
40
+ * The all-parts lane from an undated key: the first `-<part>-<subpart>`
41
+ * (when a subpart is given), else the first `-<part>`, that is not
42
+ * followed by a dash is stripped. A segment that ends in a digit never
43
+ * continues into a digit, so part `1` does not match the start of `-10`;
44
+ * a letter suffix that norm glued on (`ED1`, `RLV`) does not block the
45
+ * strip. A blank part strips nothing.
46
+ */
47
+ export function allPartsNorm(undated, part, subpart) {
48
+ if (part === undefined || part === "")
49
+ return undated;
50
+ if (subpart !== undefined && subpart !== "") {
51
+ const stripped = stripTrailingSegment(undated, `${part}-${subpart}`);
52
+ if (stripped !== undefined)
53
+ return stripped;
54
+ }
55
+ return stripTrailingSegment(undated, part) ?? undated;
56
+ }
57
+ function facetText(raw) {
58
+ if (typeof raw === "string")
59
+ return raw;
60
+ if (raw !== undefined && raw !== null && typeof raw === "object" && !Array.isArray(raw)) {
61
+ const value = raw["value"];
62
+ if (typeof value === "string")
63
+ return value;
64
+ if (typeof value === "number")
65
+ return String(value);
66
+ }
67
+ return undefined;
68
+ }
69
+ function isPresent(value) {
70
+ return value !== undefined && value !== null;
71
+ }
72
+ /** The component record that carries the structural part: the
73
+ * identifier's own, else its base's. */
74
+ function partRecord(components) {
75
+ if (isPresent(components["part"]))
76
+ return components;
77
+ const base = components["base"];
78
+ if (isPresent(base) && typeof base === "object" && !Array.isArray(base)) {
79
+ return base;
80
+ }
81
+ return undefined;
82
+ }
83
+ /**
84
+ * The structural part of a canonical component record: the identifier's
85
+ * own `part` facet, else the base's (Ruby's `id.part || id.base&.part`).
86
+ * A part facet is either a string or a typed record carrying `value`
87
+ * (the NIST lettered parts); anything else is no part.
88
+ */
89
+ export function structuralPart(components) {
90
+ const record = partRecord(components);
91
+ return record === undefined ? undefined : facetText(record["part"]);
92
+ }
93
+ function structuralSubpart(components) {
94
+ const record = partRecord(components);
95
+ return record === undefined ? undefined : facetText(record["subpart"]);
96
+ }
97
+ /** The lane keys for an already-canonical record: norm from the render,
98
+ * undated from the norm, all_parts from the parsed part and subpart. */
99
+ export function laneKeysFrom(canonical, components) {
100
+ const dated = norm(canonical);
101
+ const undated = undatedNorm(dated);
102
+ return {
103
+ dated,
104
+ undated,
105
+ all_parts: allPartsNorm(undated, structuralPart(components), structuralSubpart(components)),
106
+ };
107
+ }
108
+ /** The lane keys of a parsed identifier: `laneKeysFrom(id.toHuman(),
109
+ * id.toHash())`. Use it on the identifier that a worker flavor entry
110
+ * (`dist/flavors/<flavor>/worker.js`) returns. */
111
+ export function laneKeysOf(identifier) {
112
+ return laneKeysFrom(identifier.toHuman(), identifier.toHash());
113
+ }
@@ -186,10 +186,11 @@ export class BaseIdentifier {
186
186
  /** Serialize one attribute's value (component → toWire, nested identifier → toHash, scalars as-is). */
187
187
  serializeValue(value) {
188
188
  // A nested identifier serializes through the NESTED mapping list: a
189
- // class whose top-level wire deletes derived keys (the Ruby reference
190
- // drops JointDevelopment's derived publisher/copublisher only on the
191
- // public to_hash — lutaml's nested transform reads the accessors and
192
- // keeps them) must keep them here.
189
+ // flavor class declares which derived keys drop on which path. Since
190
+ // the reference's nested-safe compact_hash twins (gem#806), the
191
+ // JointDevelopment/DualPublished/AdoptedStandard deletes apply on the
192
+ // nested path too (their mappingsNested filters); classes without a
193
+ // twin keep the derived keys here.
193
194
  if (value instanceof BaseIdentifier)
194
195
  return value.toHashNested();
195
196
  if (value instanceof Component)
@@ -1,3 +1,6 @@
1
+ import { type LaneKeys } from "./lane-keys.js";
2
+ export { norm, undatedNorm, allPartsNorm, structuralPart, laneKeysFrom, laneKeysOf, } from "./lane-keys.js";
3
+ export type { LaneKeys, LaneKeySource } from "./lane-keys.js";
1
4
  /** The failure class of the parse surface: every rejected input and
2
5
  * unknown flavor raises this (wrapped engine errors ride as `cause`). */
3
6
  export declare class ParseError extends Error {
@@ -11,18 +14,6 @@ export declare class ParseError extends Error {
11
14
  cause?: unknown;
12
15
  });
13
16
  }
14
- /** The lane keys of one identifier: the lookup lanes the corpus and the
15
- * consumers index by. */
16
- export interface LaneKeys {
17
- /** The dated lane: the normalized canonical (uppercased, de-spaced). */
18
- dated: string;
19
- /** The undated lane: every colon-year not followed by a dash is gone
20
- * (base and supplement alike — one rule, no per-flavor casing). */
21
- undated: string;
22
- /** The all-parts lane: the parsed part stripped from the undated lane.
23
- * Structural only — an unparsed trailing "-N" is never a part. */
24
- all_parts: string;
25
- }
26
17
  /** One successful parse: the structured components, the canonical render
27
18
  * and the lane keys, per the export contract of pubid-ts#226. */
28
19
  export interface ParseResult {
@@ -45,25 +36,6 @@ export interface ParseResult {
45
36
  /** The dated / undated / all_parts lane keys. */
46
37
  keys: LaneKeys;
47
38
  }
48
- /**
49
- * The dated lane: the canonical render uppercased and de-spaced. Ruby's
50
- * `canonical.upcase.delete(" ")` — exactly the space character is
51
- * deleted, not every whitespace run.
52
- */
53
- export declare function norm(canonical: string): string;
54
- /**
55
- * The undated lane from a norm key: every `:?`-year not followed by a
56
- * dash is stripped — globally, base and supplement years alike. Ruby's
57
- * `gsub(/:?(?:19|20)\d{2}(?=[^-]*$)/, "")` verbatim.
58
- */
59
- export declare function undatedNorm(normKey: string): string;
60
- /**
61
- * The all-parts lane from an undated key: the FIRST `-<part>` not
62
- * followed by a dash is stripped. Ruby's
63
- * `sub(/-#{Regexp.escape(part)}(?=[^-]*$)/, "")` — only a structurally
64
- * parsed part is ever stripped; a blank part strips nothing.
65
- */
66
- export declare function allPartsNorm(undated: string, part?: string): string;
67
39
  /**
68
40
  * Parse one identifier: the structured components per parse, the
69
41
  * canonical render, the URN and the lane keys in one result. Rejections
@@ -1,6 +1,8 @@
1
1
  import { grammarImplementation } from "./flavors/index.js";
2
2
  import { corpusModeImplementation } from "./implementations/corpus-mode.js";
3
3
  import { loadBundledCorpus } from "./corpus/artifact.js";
4
+ import { laneKeysFrom, structuralPart } from "./lane-keys.js";
5
+ export { norm, undatedNorm, allPartsNorm, structuralPart, laneKeysFrom, laneKeysOf, } from "./lane-keys.js";
4
6
  /** The failure class of the parse surface: every rejected input and
5
7
  * unknown flavor raises this (wrapped engine errors ride as `cause`). */
6
8
  export class ParseError extends Error {
@@ -40,73 +42,6 @@ function implementationFor(flavor) {
40
42
  return corpus;
41
43
  throw new ParseError(`unknown flavor: ${flavor}`, { input: "", flavor });
42
44
  }
43
- /** Ruby Regexp.escape, for the all-parts strip of an arbitrary part. */
44
- function escapeRegExp(text) {
45
- return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
46
- }
47
- /**
48
- * The dated lane: the canonical render uppercased and de-spaced. Ruby's
49
- * `canonical.upcase.delete(" ")` — exactly the space character is
50
- * deleted, not every whitespace run.
51
- */
52
- export function norm(canonical) {
53
- return canonical.toUpperCase().replaceAll(" ", "");
54
- }
55
- /**
56
- * The undated lane from a norm key: every `:?`-year not followed by a
57
- * dash is stripped — globally, base and supplement years alike. Ruby's
58
- * `gsub(/:?(?:19|20)\d{2}(?=[^-]*$)/, "")` verbatim.
59
- */
60
- export function undatedNorm(normKey) {
61
- return normKey.replace(/:?(?:19|20)\d{2}(?=[^-]*$)/g, "");
62
- }
63
- /**
64
- * The all-parts lane from an undated key: the FIRST `-<part>` not
65
- * followed by a dash is stripped. Ruby's
66
- * `sub(/-#{Regexp.escape(part)}(?=[^-]*$)/, "")` — only a structurally
67
- * parsed part is ever stripped; a blank part strips nothing.
68
- */
69
- export function allPartsNorm(undated, part) {
70
- if (part === undefined || part === "")
71
- return undated;
72
- return undated.replace(new RegExp(`-${escapeRegExp(part)}(?=[^-]*$)`), "");
73
- }
74
- /**
75
- * The structural part of a canonical component record: the identifier's
76
- * own `part` facet, else the base's (Ruby's `id.part || id.base&.part`).
77
- * A part facet is either a string or a typed record carrying `value`
78
- * (the NIST lettered parts); anything else is no part.
79
- */
80
- function structuralPart(components) {
81
- const base = components["base"];
82
- const raw = components["part"] !== undefined && components["part"] !== null
83
- ? components["part"]
84
- : base !== undefined && base !== null && typeof base === "object"
85
- ? base["part"]
86
- : undefined;
87
- if (typeof raw === "string")
88
- return raw;
89
- if (raw !== undefined && raw !== null && typeof raw === "object" && !Array.isArray(raw)) {
90
- const value = raw["value"];
91
- if (typeof value === "string")
92
- return value;
93
- if (typeof value === "number")
94
- return String(value);
95
- }
96
- return undefined;
97
- }
98
- /** The lane keys for an already-canonical record: norm from the render,
99
- * undated from the norm, all_parts from the parsed part — the corpus
100
- * lane derivations, nothing guessed. */
101
- function laneKeysFrom(canonical, components) {
102
- const dated = norm(canonical);
103
- const undated = undatedNorm(dated);
104
- return {
105
- dated,
106
- undated,
107
- all_parts: allPartsNorm(undated, structuralPart(components)),
108
- };
109
- }
110
45
  /** The year facet of a component record, string-normalized. */
111
46
  function structuralYear(components) {
112
47
  const year = components["year"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pubid/pubid",
3
- "version": "0.1.72",
3
+ "version": "0.1.73",
4
4
  "description": "TypeScript PubID identifiers: resolution, normalization and canonical hashes for every identifier in the pubid-testsuite corpus (41 standards bodies), with a conformance runner mirroring the Ruby reference",
5
5
  "type": "module",
6
6
  "license": "MIT",