mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:50:33 +08:00
29 lines
579 B
JavaScript
Executable File
29 lines
579 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)
|
|
}
|
|
|
|
/** @type {Number} */ value
|
|
|
|
valueOf() {
|
|
return this.value
|
|
}
|
|
|
|
toString() {
|
|
return this.value.toString()
|
|
}
|
|
}
|