MCPcopy Create free account
hub / github.com/codemix/graph / parseElementId

Function parseElementId

packages/graph/src/GraphStorage.ts:10–18  ·  view source on GitHub ↗
(
  id: ElementId<TLabel>,
)

Source from the content-addressed store, hash-verified

8 * @returns The label and uuid.
9 */
10export function parseElementId<TLabel extends string = string>(
11 id: ElementId<TLabel>,
12): [label: TLabel, uuid: string] {
13 const parts = id.split(":", 2);
14 if (parts.length !== 2) {
15 throw new Error(`Invalid element id: ${id}`);
16 }
17 return parts as [TLabel, string];
18}
19
20/**
21 * Get the label from an element id.

Callers 14

getVertexByIdMethod · 0.90
getEdgeByIdMethod · 0.90
getIncomingEdgesMethod · 0.90
getOutgoingEdgesMethod · 0.90
addVertexMethod · 0.90
deleteVertexMethod · 0.90
addEdgeMethod · 0.90
deleteEdgeMethod · 0.90
getVertexMapMethod · 0.90
getEdgeMapMethod · 0.90
updatePropertyMethod · 0.90
labelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected