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

Method doEncode

source/plugins/community/splatoon/s3si/index.ts:2389–2404  ·  view source on GitHub ↗
(object, depth)

Source from the content-addressed store, hash-verified

2387 return this.getUint8Array();
2388 }
2389 doEncode(object, depth) {
2390 if (depth > this.maxDepth) {
2391 throw new Error(`Too deep objects in depth ${depth}`);
2392 }
2393 if (object == null) {
2394 this.encodeNil();
2395 } else if (typeof object === "boolean") {
2396 this.encodeBoolean(object);
2397 } else if (typeof object === "number") {
2398 this.encodeNumber(object);
2399 } else if (typeof object === "string") {
2400 this.encodeString(object);
2401 } else {
2402 this.encodeObject(object, depth);
2403 }
2404 }
2405 ensureBufferSizeToWrite(sizeToWrite) {
2406 const requiredSize = this.pos + sizeToWrite;
2407 if (this.view.byteLength < requiredSize) {

Callers 3

encodeMethod · 0.95
encodeArrayMethod · 0.95
encodeMapMethod · 0.95

Calls 5

encodeNilMethod · 0.95
encodeBooleanMethod · 0.95
encodeNumberMethod · 0.95
encodeStringMethod · 0.95
encodeObjectMethod · 0.95

Tested by

no test coverage detected