Files
ueblueprint/js/entity/IntegerEntity.js
2022-03-30 21:59:41 +02:00

32 lines
627 B
JavaScript
Executable File

// @ts-check
import IEntity from "./IEntity"
export default class IntegerEntity extends IEntity {
static attributes = {
value: Number,
}
/**
* @param {Object | Number | String} options
*/
constructor(options = 0) {
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()
}
}