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

Method decode

lib.commonjs/abi/coders/array.js:146–162  ·  view source on GitHub ↗
(reader)

Source from the content-addressed store, hash-verified

144 return pack(writer, coders, value);
145 }
146 decode(reader) {
147 let count = this.length;
148 if (count === -1) {
149 count = reader.readIndex();
150 // Check that there is *roughly* enough data to ensure
151 // stray random data is not being read as a length. Each
152 // slot requires at least 32 bytes for their value (or 32
153 // bytes as a link to the data). This could use a much
154 // tighter bound, but we are erroring on the side of safety.
155 (0, index_js_1.assert)(count * abstract_coder_js_1.WordSize <= reader.dataLength, "insufficient data length", "BUFFER_OVERRUN", { buffer: reader.bytes, offset: count * abstract_coder_js_1.WordSize, length: reader.dataLength });
156 }
157 let coders = [];
158 for (let i = 0; i < count; i++) {
159 coders.push(new anonymous_js_1.AnonymousCoder(this.coder));
160 }
161 return unpack(reader, coders);
162 }
163}
164exports.ArrayCoder = ArrayCoder;
165//# sourceMappingURL=array.js.map

Callers 1

unpackFunction · 0.45

Calls 2

unpackFunction · 0.70
readIndexMethod · 0.45

Tested by

no test coverage detected