Files
ueblueprint/js/entity/IntegerEntity.js
2022-03-10 21:13:55 +01:00

27 lines
544 B
JavaScript
Executable File

import IEntity from "./IEntity"
export default class IntegerEntity extends IEntity {
static attributes = {
value: Number
}
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()
}
}