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

      Type Parameters

      • E extends EnumOrObject
      • V extends string | number
      • X extends boolean

      Parameters

      • obj: E

        The EnumOrObject to source reverse mappings from

      • val: V

        One of obj's values to stringify

      • options: getEnumStrOptions<V, X> = {}

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