Files
ueblueprint/js/entity/Integer64Entity.js
barsdeveloper 8a2cd6c26e Fixing still
2024-07-17 21:38:10 +02:00

41 lines
882 B
JavaScript
Executable File

import P from "parsernostrum"
import IEntity from "./IEntity.js"
export default class Integer64Entity extends IEntity {
static grammar = /** @type {P<Integer64Entity>} */(
P.numberBigInteger.map(v => new this(v))
)
/** @type {bigint} */
#value
get value() {
return this.#value
}
set value(value) {
if (value >= -(1n << 63n) && value < 1n << 63n) {
this.#value = value
}
}
/** @param {bigint | Number} value */
constructor(value = 0n) {
super()
this.value = BigInt(value)
}
valueOf() {
return this.value
}
toString(
insideString = false,
indentation = "",
Self = this.Self(),
printKey = Self.printKey,
wrap = Self.wrap,
) {
return this.value.toString()
}
}