mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:50:33 +08:00
Refactoring, various fixes
This commit is contained in:
27
js/entity/IdentifierEntity.js
Normal file
27
js/entity/IdentifierEntity.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import IEntity from "./IEntity"
|
||||
|
||||
|
||||
export default class IdentifierEntity extends IEntity {
|
||||
|
||||
static attributes = {
|
||||
value: String,
|
||||
}
|
||||
|
||||
constructor(options = {}) {
|
||||
// Not instanceof to pick also primitive string
|
||||
if (options.constructor === String) {
|
||||
options = {
|
||||
value: options
|
||||
}
|
||||
}
|
||||
super(options)
|
||||
}
|
||||
|
||||
valueOf() {
|
||||
return this.value
|
||||
}
|
||||
|
||||
toString() {
|
||||
return this.value
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user