@opra/common
Version:
Opra common package
39 lines (38 loc) • 1.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BigintType = void 0;
const tslib_1 = require("tslib");
const valgen_1 = require("valgen");
const constants_js_1 = require("../../constants.js");
const simple_type_js_1 = require("../simple-type.js");
const number_type_js_1 = require("./number.type.js");
let BigintType = class BigintType extends number_type_js_1.NumberType {
constructor(attributes) {
super(attributes);
}
[constants_js_1.DECODER](properties) {
const x = [];
if (properties.minValue != null)
x.push(valgen_1.vg.isGte(properties.minValue));
if (properties.maxValue != null)
x.push(valgen_1.vg.isLte(properties.maxValue));
return x.length > 0
? valgen_1.vg.pipe([valgen_1.toBigint, ...x], { returnIndex: 0 })
: valgen_1.toBigint;
}
[constants_js_1.ENCODER](properties) {
return this[constants_js_1.DECODER](properties);
}
};
exports.BigintType = BigintType;
exports.BigintType = BigintType = tslib_1.__decorate([
(0, simple_type_js_1.SimpleType)({
name: 'bigint',
description: 'BigInt number',
nameMappings: {
js: 'bigint',
json: 'string',
},
}),
tslib_1.__metadata("design:paramtypes", [Object])
], BigintType);