MCPcopy
hub / github.com/cinnyapp/cinny / get

Method get

src/app/utils/ASCIILexicalTable.ts:123–148  ·  view source on GitHub ↗
(index: number)

Source from the content-addressed store, hash-verified

121 }
122
123 get(index: number): string | undefined {
124 if (!this.hasIndex(index)) {
125 return undefined;
126 }
127
128 let str = '';
129 const chars = this.rangeCount(this.startCode, this.endCode);
130
131 for (let toIndex = index, i = 0; i < this.maxStrWidth; i += 1) {
132 const opStrWidth = this.maxStrWidth - i;
133 const opStrTableSize = this.getWidthToSize(opStrWidth);
134
135 const segmentSize = opStrTableSize / chars;
136
137 const segmentIndex = Math.floor(toIndex / segmentSize);
138 str += String.fromCharCode(this.startCode + segmentIndex);
139
140 toIndex -= segmentIndex * segmentSize;
141 if (toIndex === 0) {
142 break;
143 }
144 toIndex -= 1;
145 }
146
147 return str;
148 }
149
150 previous(str: string): string | undefined {
151 if (!this.has(str)) return undefined;

Callers 15

betweenMethod · 0.95
nBetweenMethod · 0.95
setSessionFunction · 0.80
requestSessionFunction · 0.80
sw.tsFile · 0.80
hasPrivateKeyFunction · 0.80
getPrivateKeyFunction · 0.80
pushImageFunction · 0.80
renderImageFunction · 0.80
Reply.tsxFile · 0.80
addAllParentIdsFunction · 0.80

Calls 2

hasIndexMethod · 0.95
getWidthToSizeMethod · 0.95

Tested by

no test coverage detected