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

Method verify

projects/JavaScript/proto/fbe.js:4973–5000  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

4971 * @returns {!number} Final model size or Number.MAX_SAFE_INTEGER in case of any error
4972 */
4973 verify () {
4974 if ((this._buffer.offset + this.fbeOffset + 4) > this._buffer.size) {
4975 return Number.MAX_SAFE_INTEGER
4976 }
4977
4978 let fbeMapSize = this.readUInt32(this.fbeOffset)
4979
4980 let size = 4
4981 this._modelKey.fbeOffset = this.fbeOffset + 4
4982 this._modelValue.fbeOffset = this.fbeOffset + 4
4983 for (let i = 0; i < fbeMapSize; i++) {
4984 let offsetKey = this._modelKey.verify()
4985 if (offsetKey === Number.MAX_SAFE_INTEGER) {
4986 return Number.MAX_SAFE_INTEGER
4987 }
4988 this._modelKey.fbeShift(offsetKey)
4989 this._modelValue.fbeShift(offsetKey)
4990 size += offsetKey
4991 let offsetValue = this._modelValue.verify()
4992 if (offsetValue === Number.MAX_SAFE_INTEGER) {
4993 return Number.MAX_SAFE_INTEGER
4994 }
4995 this._modelKey.fbeShift(offsetValue)
4996 this._modelValue.fbeShift(offsetValue)
4997 size += offsetValue
4998 }
4999 return size
5000 }
5001
5002 /**
5003 * Get the map

Callers

nothing calls this directly

Calls 3

readUInt32Method · 0.45
verifyMethod · 0.45
fbeShiftMethod · 0.45

Tested by

no test coverage detected