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

Method deserialize

projects/JavaScript/proto/proto.js:2421–2434  ·  view source on GitHub ↗

* Deserialize the struct value * @this {!BalanceModel} * @param {!Balance} value Balance value, defaults is new Balance() * @return {!object} Deserialized Balance value and its size

(value = new Balance())

Source from the content-addressed store, hash-verified

2419 * @return {!object} Deserialized Balance value and its size
2420 */
2421 deserialize (value = new Balance()) {
2422 if ((this.buffer.offset + this.model.fbeOffset - 4) > this.buffer.size) {
2423 return { value: new Balance(), size: 0 }
2424 }
2425
2426 let fbeFullSize = this.readUInt32(this.model.fbeOffset - 4)
2427 console.assert((fbeFullSize >= this.model.fbeSize), 'Model is broken!')
2428 if (fbeFullSize < this.model.fbeSize) {
2429 return { value: new Balance(), size: 0 }
2430 }
2431
2432 this.model.get(value)
2433 return { value: value, size: fbeFullSize }
2434 }
2435
2436 /**
2437 * Move to the next struct value

Callers 1

cloneMethod · 0.95

Calls 2

readUInt32Method · 0.45
getMethod · 0.45

Tested by

no test coverage detected