PokéRogue
    Preparing search index...
    • Return the name of an enum member or const object value, alongside its corresponding value.

      Type Parameters

      Parameters

      • obj: E

        The EnumOrObject to source reverse mappings from

      • val: ObjectValues<E>

        One of obj's values

      • options: getEnumStrOptions = {}

        Options modifying the stringification process

      Returns string

      The stringified representation of val as dictated by the options.

      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)"