MCPcopy
hub / github.com/witheve/Eve / _make

Method _make

src/runtime/id.ts:10–35  ·  view source on GitHub ↗
(origKey: string, parts: any[])

Source from the content-addressed store, hash-verified

8 }
9
10 _make(origKey: string, parts: any[]) {
11 let ix = 0;
12 let changed = false;
13 for(let part of parts) {
14 let found = this.idToParts[part]
15 if(found !== undefined) {
16 parts[ix] = found;
17 changed = true;
18 }
19 ix++;
20 }
21 let updatedKey = origKey;
22 if(changed) {
23 updatedKey = `⦑${parts.join("⦒")}`;
24 }
25 let id = this._makeStringId();
26 let loadedValue = this.partsToId[updatedKey];
27 if(loadedValue) {
28 this.partsToId[origKey] = loadedValue;
29 this.idToParts[loadedValue] = updatedKey;
30 } else {
31 this.partsToId[origKey] = id;
32 this.idToParts[id] = updatedKey;
33 }
34 return id;
35 }
36
37 isId(id: any) {
38 return id.substring && id[0] === "⦑";

Callers 1

getMethod · 0.95

Calls 1

_makeStringIdMethod · 0.95

Tested by

no test coverage detected