mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-12 07:34:42 +08:00
19 lines
478 B
JavaScript
Executable File
19 lines
478 B
JavaScript
Executable File
import P from "parsernostrum"
|
|
import Utility from "../Utility.js"
|
|
import IntegerEntity from "./IntegerEntity.js"
|
|
|
|
export default class NaturalNumberEntity extends IntegerEntity {
|
|
|
|
static grammar = /** @type {P<NaturalNumberEntity>} */(
|
|
P.numberNatural.map(v => new this(v))
|
|
)
|
|
|
|
get value() {
|
|
return super.value
|
|
}
|
|
set value(value) {
|
|
value = Math.round(Utility.clamp(this.value, 0))
|
|
super.value = value
|
|
}
|
|
}
|