Still WIP

This commit is contained in:
barsdeveloper
2024-05-28 16:44:39 +02:00
parent 70b4cabb97
commit 1c2778fbf8
62 changed files with 2480 additions and 2853 deletions

View File

@@ -1,17 +1,17 @@
import IntegerEntity from "./IntegerEntity.js"
import Parsernostrum from "parsernostrum"
import P from "parsernostrum"
import Utility from "../Utility.js"
import IntegerEntity from "./IntegerEntity.js"
export default class NaturalNumberEntity extends IntegerEntity {
static grammar = this.createGrammar()
static grammar = P.numberNatural.map(v => new this(v))
static createGrammar() {
return Parsernostrum.numberNatural.map(v => new this(v))
set value(value) {
value = Math.round(Utility.clamp(this.value, 0))
super.value = value
}
constructor(values = 0) {
super(values)
this.value = Math.round(Utility.clamp(this.value, 0))
constructor(value = 0) {
super(value)
}
}