@pubid/pubid 0.1.32 → 0.1.33
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/artifact/corpus.json.gz +0 -0
- package/dist/conformance/implementation.d.ts +4 -0
- package/dist/implementations/corpus-mode.d.ts +3 -0
- package/dist/implementations/corpus-mode.js +7 -0
- package/dist/model/identifier.d.ts +3 -0
- package/dist/model/identifier.js +5 -0
- package/package.json +1 -1
- package/vendor/parg/nist.json +1 -1
package/artifact/corpus.json.gz
CHANGED
|
Binary file
|
|
@@ -16,6 +16,10 @@ export interface Identifier {
|
|
|
16
16
|
toHash(): Record<string, unknown>;
|
|
17
17
|
/** The canonical human spelling. */
|
|
18
18
|
toHuman(): string;
|
|
19
|
+
/** The renderer body every flavor writes; `toString()` delegates here. */
|
|
20
|
+
render(): string;
|
|
21
|
+
/** String coercion of the identifier — the canonical human spelling. */
|
|
22
|
+
toString(): string;
|
|
19
23
|
/** The URN; undefined when the flavor emits none. */
|
|
20
24
|
toUrn(): string | undefined;
|
|
21
25
|
/** Deserialize the canonical hash; the idempotency gate relies on it. */
|
|
@@ -20,6 +20,9 @@ export declare class CorpusBackedIdentifier implements Identifier {
|
|
|
20
20
|
constructor(row: CorpusRow, resolveHash: (hash: Record<string, unknown>) => CorpusRow);
|
|
21
21
|
toHash(): Record<string, unknown>;
|
|
22
22
|
toHuman(): string;
|
|
23
|
+
/** The corpus row's canonical human spelling — `toString()` delegates here. */
|
|
24
|
+
render(): string;
|
|
25
|
+
toString(): string;
|
|
23
26
|
toUrn(): string | undefined;
|
|
24
27
|
fromHash(hash: Record<string, unknown>): Identifier;
|
|
25
28
|
}
|
|
@@ -61,6 +61,13 @@ export class CorpusBackedIdentifier {
|
|
|
61
61
|
toHuman() {
|
|
62
62
|
return this.row.human;
|
|
63
63
|
}
|
|
64
|
+
/** The corpus row's canonical human spelling — `toString()` delegates here. */
|
|
65
|
+
render() {
|
|
66
|
+
return this.row.human;
|
|
67
|
+
}
|
|
68
|
+
toString() {
|
|
69
|
+
return this.row.human;
|
|
70
|
+
}
|
|
64
71
|
toUrn() {
|
|
65
72
|
return this.row.urn;
|
|
66
73
|
}
|
|
@@ -53,6 +53,9 @@ export declare abstract class BaseIdentifier {
|
|
|
53
53
|
constructor(attrs?: Record<string, unknown>);
|
|
54
54
|
/** The human form (Ruby render(format: :human) → the flavor renderer). */
|
|
55
55
|
toHuman(): string;
|
|
56
|
+
/** String coercion answers the canonical human spelling — without this
|
|
57
|
+
* override `String(id)` and template literals print "[object Object]". */
|
|
58
|
+
toString(): string;
|
|
56
59
|
/** Ruby to_urn: the flavor's UrnGenerator, else the base template. */
|
|
57
60
|
toUrn(): string;
|
|
58
61
|
fromHash(hash: Record<string, unknown>): BaseIdentifier;
|
package/dist/model/identifier.js
CHANGED
|
@@ -97,6 +97,11 @@ export class BaseIdentifier {
|
|
|
97
97
|
toHuman() {
|
|
98
98
|
return this.render();
|
|
99
99
|
}
|
|
100
|
+
/** String coercion answers the canonical human spelling — without this
|
|
101
|
+
* override `String(id)` and template literals print "[object Object]". */
|
|
102
|
+
toString() {
|
|
103
|
+
return this.render();
|
|
104
|
+
}
|
|
100
105
|
/** Ruby to_urn: the flavor's UrnGenerator, else the base template. */
|
|
101
106
|
toUrn() {
|
|
102
107
|
const Generator = this.constructor.urnGenerator ?? BaseUrnGenerator;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubid/pubid",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.33",
|
|
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",
|