@graphty/graph-io / @graphty/graph-io / IdCoercer
Class: IdCoercer ​
Defined in: common/ids.ts:125
A stateful coercer for one import call: applies the rule and, under "number", detects merges (two distinct texts mapping to one number) so the importer can report them as coercion issues.
Constructors ​
Constructor ​
new IdCoercer(
mode):IdCoercer
Defined in: common/ids.ts:149
Create a coercer.
Parameters ​
mode ​
IdCoercion
the rule
Returns ​
IdCoercer
Properties ​
lastMerge ​
lastMerge: {
id:number;previousText:string;text:string; } |null=null
Defined in: common/ids.ts:136
The merge detected by the most recent text() call, or null.
Union Members ​
Type Literal ​
{ id: number; previousText: string; text: string; }
id ​
readonlyid:number
The number both texts became.
previousText ​
readonlypreviousText:string
The first text that became the same number.
text ​
readonlytext:string
The text just read.
null
mergeCount ​
mergeCount:
number=0
Defined in: common/ids.ts:130
Texts merged into an id another text already produced.
mode ​
readonlymode:IdCoercion
Defined in: common/ids.ts:127
The rule.
Methods ​
text() ​
text(
text):NodeId
Defined in: common/ids.ts:160
Coerce a text cell, recording a merge under "number" when a different text already produced the same number.
Parameters ​
text ​
string
the cell text
Returns ​
NodeId
the id
value() ​
value(
value):NodeId
Defined in: common/ids.ts:180
Coerce a typed value.
Parameters ​
value ​
unknown
the value
Returns ​
NodeId
the id