mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:50:33 +08:00
31 lines
614 B
JavaScript
Executable File
31 lines
614 B
JavaScript
Executable File
import Entity from "./Entity"
|
|
|
|
export default class IntegerEntity extends Entity {
|
|
|
|
static attributes = {
|
|
value: Number
|
|
}
|
|
|
|
getAttributes() {
|
|
return IntegerEntity.attributes
|
|
}
|
|
|
|
constructor(options = {}) {
|
|
if (options.constructor === Number || options.constructor === String) {
|
|
options = {
|
|
value: options
|
|
}
|
|
}
|
|
super(options)
|
|
this.value = Math.round(this.value)
|
|
}
|
|
|
|
valueOf() {
|
|
return this.value
|
|
}
|
|
|
|
toString() {
|
|
return this.value.toString()
|
|
}
|
|
}
|