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

Method verify

projects/JavaScript/proto/fbe.js:2221–2240  ·  view source on GitHub ↗

* Check if the optional value is valid * @this {!FieldModelOptional} * @returns {!boolean} Field model valid state

()

Source from the content-addressed store, hash-verified

2219 * @returns {!boolean} Field model valid state
2220 */
2221 verify () {
2222 if ((this._buffer.offset + this.fbeOffset + this.fbeSize) > this._buffer.size) {
2223 return true
2224 }
2225
2226 let fbeHasValue = this.readUInt8(this.fbeOffset)
2227 if (fbeHasValue === 0) {
2228 return true
2229 }
2230
2231 let fbeOptionalOffset = this.readUInt32(this.fbeOffset + 1)
2232 if (fbeOptionalOffset === 0) {
2233 return false
2234 }
2235
2236 this._buffer.shift(fbeOptionalOffset)
2237 let fbeResult = this.value.verify()
2238 this._buffer.unshift(fbeOptionalOffset)
2239 return fbeResult
2240 }
2241
2242 /**
2243 * Get the optional value (being phase)

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected