(object, depth)
| 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) { |
no test coverage detected