✨ add find()
helper to enums (find enum by name)
This commit is contained in:
parent
12104f6d65
commit
5054f1b51f
@ -25,4 +25,11 @@ class Juicescript_helper_enum {
|
|||||||
name(value){
|
name(value){
|
||||||
return Object.keys(this).find(key => this[key] === value);
|
return Object.keys(this).find(key => this[key] === value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GETTER: Find enum by name
|
||||||
|
*/
|
||||||
|
find(name){
|
||||||
|
return this[name.toUpperCase()] ?? null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user