MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / verify

Method verify

projects/JavaScript/proto/fbe.js:4542–4556  ·  view source on GitHub ↗

* Check if the optional value is valid * @this {!FinalModelOptional} * @returns {!number} Final model size or Number.MAX_SAFE_INTEGER in case of any error

()

Source from the content-addressed store, hash-verified

4540 * @returns {!number} Final model size or Number.MAX_SAFE_INTEGER in case of any error
4541 */
4542 verify () {
4543 if ((this._buffer.offset + this.fbeOffset + 1) > this._buffer.size) {
4544 return Number.MAX_SAFE_INTEGER
4545 }
4546
4547 let fbeHasValue = this.readUInt8(this.fbeOffset)
4548 if (fbeHasValue === 0) {
4549 return 1
4550 }
4551
4552 this._buffer.shift(this.fbeOffset + 1)
4553 let fbeResult = this.value.verify()
4554 this._buffer.unshift(this.fbeOffset + 1)
4555 return 1 + fbeResult
4556 }
4557
4558 /**
4559 * Get the optional value

Callers

nothing calls this directly

Calls 4

readUInt8Method · 0.45
shiftMethod · 0.45
verifyMethod · 0.45
unshiftMethod · 0.45

Tested by

no test coverage detected