mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-03-06 15:47:30 +08:00
Still WIP
This commit is contained in:
20
js/entity/BooleanEntity.js
Executable file
20
js/entity/BooleanEntity.js
Executable file
@@ -0,0 +1,20 @@
|
||||
import P from "parsernostrum"
|
||||
import IEntity from "./IEntity.js"
|
||||
|
||||
export default class BooleanEntity extends IEntity {
|
||||
|
||||
static grammar = P.regArray(/(true)|false/i).map(v => v[1] ? new this(true) : new this(false))
|
||||
|
||||
constructor(value = false) {
|
||||
super()
|
||||
this.value = value
|
||||
}
|
||||
|
||||
valueOf() {
|
||||
return this.value
|
||||
}
|
||||
|
||||
toString() {
|
||||
return this.value.toString()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user