electr0lysis
Version:
Simple framework for data serialization and interchange.
22 lines • 828 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
require("f1ux/array/operator/first");
const decode_1 = require("../decode");
class ArrayDecoder {
decode(type, view, offset, context) {
let position = offset;
const length = context.decode({ name: "Uint32" }, view, position);
position += length.size;
const parameters = type.parameters;
const parameter = parameters.first();
const array = decode_1.default([
{ type: parameter, quantity: length.value }
], view, position, context);
position += array.size;
const value = array.value.first();
const size = position - offset;
return { value, size };
}
}
exports.default = ArrayDecoder;
//# sourceMappingURL=ArrayDecoder.js.map