0
0

add find() helper to enums (find enum by name)

This commit is contained in:
DrMaxNix 2022-10-02 17:40:02 +02:00
parent 12104f6d65
commit 5054f1b51f

View File

@ -25,4 +25,11 @@ class Juicescript_helper_enum {
name(value){
return Object.keys(this).find(key => this[key] === value);
}
/*
GETTER: Find enum by name
*/
find(name){
return this[name.toUpperCase()] ?? null;
}
}