diffusion
Version:
Diffusion JavaScript client
58 lines (57 loc) • 2.15 kB
JavaScript
;
/**
* @module diffusion.datatypes
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Int64DataTypeImpl = void 0;
var decoder_1 = require("./../../cbor/decoder");
var int64_impl_1 = require("./../../data/primitive/int64-impl");
var primitive_datatype_1 = require("./../../data/primitive/primitive-datatype");
/**
* Serialise an Int64 value into a CBOR encoder
*
* @param value the value to serialise
* @param encoder the encoder
*/
function serialise(value, encoder) {
if (value === null || value === undefined) {
encoder.encode(null);
}
else {
encoder.writeInt64(new int64_impl_1.Int64Impl(value));
}
}
/**
* A data type for Int64 values
*/
var Int64DataTypeImpl = /** @class */ (function (_super) {
__extends(Int64DataTypeImpl, _super);
/**
* Create a new Int64DataTypeImpl instance
*/
function Int64DataTypeImpl() {
var _this = _super.call(this, 'int64', int64_impl_1.Int64Impl, serialise, decoder_1.isInt64, false) || this;
/**
* The implementation of the underlying value type
*/ // eslint-disable-next-line @typescript-eslint/naming-convention
_this.Int64 = int64_impl_1.Int64Impl;
return _this;
}
return Int64DataTypeImpl;
}(primitive_datatype_1.PrimitiveDataType));
exports.Int64DataTypeImpl = Int64DataTypeImpl;