@opra/common
Version:
Opra common package
36 lines (35 loc) • 1.07 kB
JavaScript
import { __decorate, __metadata } from "tslib";
import { toBigint, vg } from 'valgen';
import { DECODER, ENCODER } from '../../constants.js';
import { SimpleType } from '../simple-type.js';
import { NumberType } from './number.type.js';
let BigintType = class BigintType extends NumberType {
constructor(attributes) {
super(attributes);
}
[DECODER](properties) {
const x = [];
if (properties.minValue != null)
x.push(vg.isGte(properties.minValue));
if (properties.maxValue != null)
x.push(vg.isLte(properties.maxValue));
return x.length > 0
? vg.pipe([toBigint, ...x], { returnIndex: 0 })
: toBigint;
}
[ENCODER](properties) {
return this[DECODER](properties);
}
};
BigintType = __decorate([
SimpleType({
name: 'bigint',
description: 'BigInt number',
nameMappings: {
js: 'bigint',
json: 'string',
},
}),
__metadata("design:paramtypes", [Object])
], BigintType);
export { BigintType };