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

Method deserialize

projects/JavaScript/proto/proto.js:3472–3485  ·  view source on GitHub ↗

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

(value = new Account())

Source from the content-addressed store, hash-verified

3470 * @return {!object} Deserialized Account value and its size
3471 */
3472 deserialize (value = new Account()) {
3473 if ((this.buffer.offset + this.model.fbeOffset - 4) > this.buffer.size) {
3474 return { value: new Account(), size: 0 }
3475 }
3476
3477 let fbeFullSize = this.readUInt32(this.model.fbeOffset - 4)
3478 console.assert((fbeFullSize >= this.model.fbeSize), 'Model is broken!')
3479 if (fbeFullSize < this.model.fbeSize) {
3480 return { value: new Account(), size: 0 }
3481 }
3482
3483 this.model.get(value)
3484 return { value: value, size: fbeFullSize }
3485 }
3486
3487 /**
3488 * 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