Return the name of an enum member or const object value, alongside its corresponding value.
const object
The EnumOrObject to source reverse mappings from
EnumOrObject
One of obj's values to stringify
obj
Optional parameters modifying the stringification process
The stringified representation of val as dictated by the options.
val
enum testEnum { ONE = 1, TWO = 2, THREE = 3,}getEnumStr(fakeEnum, fakeEnum.ONE); // Output: "ONE (=1)"getEnumStr(fakeEnum, fakeEnum.TWO, {casing: "Title", prefix: "fakeEnum.", suffix: "!!!"}); // Output: "fakeEnum.TWO!!! (=2)" Copy
enum testEnum { ONE = 1, TWO = 2, THREE = 3,}getEnumStr(fakeEnum, fakeEnum.ONE); // Output: "ONE (=1)"getEnumStr(fakeEnum, fakeEnum.TWO, {casing: "Title", prefix: "fakeEnum.", suffix: "!!!"}); // Output: "fakeEnum.TWO!!! (=2)"
Return the name of an enum member or
const objectvalue, alongside its corresponding value.