isaacscript-common 1.2.198 → 1.2.199

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -123,4 +123,4 @@ export declare function repeat(n: int, func: (i: int) => void): void;
123
123
  * Helper function to check every value of a custom enum for -1. This is helpful as a run-time check
124
124
  * because many methods of the Isaac class return -1 if they fail.
125
125
  */
126
- export declare function validateCustomEnum(customEnumName: string, customEnum: unknown): void;
126
+ export declare function validateCustomEnum(transpiledEnumName: string, transpiledEnum: unknown): void;
@@ -4,6 +4,7 @@ local __TS__ArraySort = ____lualib.__TS__ArraySort
4
4
  local __TS__StringReplace = ____lualib.__TS__StringReplace
5
5
  local __TS__StringSubstr = ____lualib.__TS__StringSubstr
6
6
  local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
7
+ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
7
8
  local ____exports = {}
8
9
  local ____directionNames = require("objects.directionNames")
9
10
  local DIRECTION_NAMES = ____directionNames.DIRECTION_NAMES
@@ -77,18 +78,21 @@ ____exports["repeat"] = function(self, n, func)
77
78
  end
78
79
  end
79
80
  end
80
- function ____exports.validateCustomEnum(self, customEnumName, customEnum)
81
- local customEnumType = type(customEnum)
81
+ function ____exports.validateCustomEnum(self, transpiledEnumName, transpiledEnum)
82
+ local customEnumType = type(transpiledEnum)
82
83
  if customEnumType ~= "table" then
83
84
  return
84
85
  end
85
- local ____table = customEnum
86
- local keys = __TS__ObjectKeys(____table)
86
+ local ____table = transpiledEnum
87
+ local keys = __TS__ArrayFilter(
88
+ __TS__ObjectKeys(____table),
89
+ function(____, key) return type(key) == "string" end
90
+ )
87
91
  __TS__ArraySort(keys)
88
92
  for ____, key in ipairs(keys) do
89
93
  local value = ____table[key]
90
94
  if value == -1 then
91
- error((("Failed to find: " .. customEnumName) .. ".") .. key)
95
+ error((("Failed to find: " .. transpiledEnumName) .. ".") .. key)
92
96
  end
93
97
  end
94
98
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.198",
3
+ "version": "1.2.199",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",