UNPKG

diffusion

Version:

Diffusion JavaScript client

57 lines (56 loc) 2.35 kB
"use strict"; /** * @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.BinaryDataTypeImpl = void 0; var abstract_datatype_1 = require("./../../data/abstract-datatype"); var binary_impl_1 = require("./../../data/binary/binary-impl"); var function_1 = require("./../../util/function"); /** * A data type for binary data */ var BinaryDataTypeImpl = /** @class */ (function (_super) { __extends(BinaryDataTypeImpl, _super); /** * Create a new BinaryDataTypeImpl instance */ function BinaryDataTypeImpl() { var _this = _super.call(this, 'binary', binary_impl_1.BinaryImpl, binary_impl_1.BinaryImpl, binary_impl_1.BinaryImpl.from, function_1.identity, [], true) || this; /** * The implementation of the underlying value type */ // eslint-disable-next-line @typescript-eslint/naming-convention _this.Binary = binary_impl_1.BinaryImpl; return _this; } /** * Create a new Binary instance from data * * @param value the CBOR data containing the record * @return a new Binary instance * @throws an {@link IllegalArgumentError} if the data is not a valid Binary */ BinaryDataTypeImpl.prototype.from = function (buffer) { return binary_impl_1.BinaryImpl.from(buffer); }; BinaryDataTypeImpl.prototype.validate = function () { // no-op. This data type validates on read. }; return BinaryDataTypeImpl; }(abstract_datatype_1.AbstractDataType)); exports.BinaryDataTypeImpl = BinaryDataTypeImpl;