MCPcopy Create free account
hub / github.com/PageLeay/celestial-runtime / encode

Method encode

lib.esm/abi/coders/array.js:124–140  ·  view source on GitHub ↗
(writer, _value)

Source from the content-addressed store, hash-verified

122 return result;
123 }
124 encode(writer, _value) {
125 const value = Typed.dereference(_value, "array");
126 if (!Array.isArray(value)) {
127 this._throwError("expected array value", value);
128 }
129 let count = this.length;
130 if (count === -1) {
131 count = value.length;
132 writer.writeValue(value.length);
133 }
134 assertArgumentCount(value.length, count, "coder array" + (this.localName ? (" " + this.localName) : ""));
135 let coders = [];
136 for (let i = 0; i < value.length; i++) {
137 coders.push(this.coder);
138 }
139 return pack(writer, coders, value);
140 }
141 decode(reader) {
142 let count = this.length;
143 if (count === -1) {

Callers 1

packFunction · 0.45

Calls 6

assertArgumentCountFunction · 0.90
packFunction · 0.70
dereferenceMethod · 0.45
isArrayMethod · 0.45
_throwErrorMethod · 0.45
writeValueMethod · 0.45

Tested by

no test coverage detected