MCPcopy
hub / github.com/lowlighter/metrics / slice

Method slice

source/plugins/community/splatoon/s3si/index.ts:1068–1087  ·  view source on GitHub ↗
(start, end = this.#len)

Source from the content-addressed store, hash-verified

1066 }
1067 }
1068 slice(start, end = this.#len) {
1069 if (end === start) {
1070 return new Uint8Array();
1071 }
1072 checkRange(start, end, this.#len);
1073 const result = new Uint8Array(end - start);
1074 const startIdx = this.getChunkIndex(start);
1075 const endIdx = this.getChunkIndex(end - 1);
1076 let written = 0;
1077 for(let i = startIdx; i < endIdx; i++){
1078 const chunk = this.#chunks[i];
1079 const len = chunk.end - chunk.start;
1080 result.set(chunk.value.subarray(chunk.start, chunk.end), written);
1081 written += len;
1082 }
1083 const last = this.#chunks[endIdx];
1084 const rest = end - start - written;
1085 result.set(last.value.subarray(last.start, last.start + rest), written);
1086 return result;
1087 }
1088 concat() {
1089 const result = new Uint8Array(this.#len);
1090 let sum = 0;

Callers 15

readDelimFunction · 0.95
markdownFunction · 0.80
pieFunction · 0.80
app.placeholder.jsFile · 0.80
index.mjsFile · 0.80
index.mjsFile · 0.80
index.mjsFile · 0.80
index.mjsFile · 0.80
patchesMethod · 0.80
cliFunction · 0.80
index.mjsFile · 0.80
index.mjsFile · 0.80

Calls 2

getChunkIndexMethod · 0.95
checkRangeFunction · 0.85

Tested by

no test coverage detected