var Stormancer;
(function (Stormancer) {
var MsgPackSerializer = (function () {
/**
Creates a new MsgPackSerializer.
@class MsgPackSerializer
@classdesc Serializer based on MessagePack.
@memberof Stormancer
*/
function MsgPackSerializer() {
/**
The name of the serializer.
*/
this.name = "msgpack/map";
}
/**
Serializes an object into a byte array.
@method Stormancer.MsgPackSerializer#serialize
@param {object} data The data to serialize.
@return {Uint8Array} The byte array.
*/
MsgPackSerializer.prototype.serialize = function (data) {
return new Uint8Array(msgpack.pack(data));
};
/**
Deserializes an object from a byte array.
@method Stormancer.MsgPackSerializer#deserialize
@memberof Stormancer.MsgPackSerializer
@param {Uint8Array} bytes The byte array
@return {object} The deserialized data.
*/
MsgPackSerializer.prototype.deserialize = function (bytes) {
return msgpack.unpack(bytes);
};
return MsgPackSerializer;
})();
Stormancer.MsgPackSerializer = MsgPackSerializer;
})(Stormancer || (Stormancer = {}));
//# sourceMappingURL=MsgPackSerializer.js.map