MCPcopy Create free account
hub / github.com/Noumena-Network/code / intern

Method intern

src/ink/screen.ts:63–72  ·  view source on GitHub ↗
(hyperlink: string | undefined)

Source from the content-addressed store, hash-verified

61 private stringMap = new Map<string, number>()
62
63 intern(hyperlink: string | undefined): number {
64 if (!hyperlink) return 0
65 let id = this.stringMap.get(hyperlink)
66 if (id === undefined) {
67 id = this.strings.length
68 this.strings.push(hyperlink)
69 this.stringMap.set(hyperlink, id)
70 }
71 return id
72 }
73
74 get(id: number): string | undefined {
75 return id === 0 ? undefined : this.strings[id]

Callers

nothing calls this directly

Calls 2

setMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected