mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-13 08:34:46 +08:00
35 lines
727 B
JavaScript
Executable File
35 lines
727 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() {
|
|
return this.value.toString()
|
|
}
|
|
}
|