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