isaacscript-common 1.2.223 → 1.2.224

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.
@@ -1,115 +1,30 @@
1
- --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__ObjectValues = ____lualib.__TS__ObjectValues
3
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
2
4
  local ____exports = {}
3
- local ____SerializableIsaacAPIClassType = require("enums.private.SerializableIsaacAPIClassType")
4
- local SerializableIsaacAPIClassType = ____SerializableIsaacAPIClassType.SerializableIsaacAPIClassType
5
- local ____color = require("functions.color")
6
- local copyColor = ____color.copyColor
7
- local isSerializedColor = ____color.isSerializedColor
5
+ local ____serializableIsaacAPIClassTypeToCopyFunction = require("objects.serializableIsaacAPIClassTypeToCopyFunction")
6
+ local SERIALIZABLE_ISAAC_API_CLASS_TYPE_TO_COPY_FUNCTION = ____serializableIsaacAPIClassTypeToCopyFunction.SERIALIZABLE_ISAAC_API_CLASS_TYPE_TO_COPY_FUNCTION
7
+ local ____serializableIsaacAPIClassTypeToIdentityFunction = require("objects.serializableIsaacAPIClassTypeToIdentityFunction")
8
+ local SERIALIZABLE_ISAAC_API_CLASS_TYPE_TO_IDENTITY_FUNCTION = ____serializableIsaacAPIClassTypeToIdentityFunction.SERIALIZABLE_ISAAC_API_CLASS_TYPE_TO_IDENTITY_FUNCTION
8
9
  local ____isaacAPIClass = require("functions.isaacAPIClass")
9
10
  local getIsaacAPIClassType = ____isaacAPIClass.getIsaacAPIClassType
10
- local ____kColor = require("functions.kColor")
11
- local copyKColor = ____kColor.copyKColor
12
- local isSerializedKColor = ____kColor.isSerializedKColor
13
- local ____rng = require("functions.rng")
14
- local copyRNG = ____rng.copyRNG
15
- local isSerializedRNG = ____rng.isSerializedRNG
16
- local ____utils = require("functions.utils")
17
- local ensureAllCases = ____utils.ensureAllCases
18
- local getEnumValues = ____utils.getEnumValues
19
- local ____vector = require("functions.vector")
20
- local copyVector = ____vector.copyVector
21
- local isSerializedVector = ____vector.isSerializedVector
22
11
  function ____exports.copySerializableIsaacAPIClass(self, isaacAPIClassOrSerializedTable, serializationType)
23
12
  local isaacAPIClassType = getIsaacAPIClassType(nil, isaacAPIClassOrSerializedTable)
24
- repeat
25
- local ____switch3 = isaacAPIClassType
26
- local ____cond3 = ____switch3 == SerializableIsaacAPIClassType.COLOR
27
- if ____cond3 then
28
- do
29
- local color = isaacAPIClassOrSerializedTable
30
- return copyColor(nil, color, serializationType)
31
- end
32
- end
33
- ____cond3 = ____cond3 or ____switch3 == SerializableIsaacAPIClassType.KCOLOR
34
- if ____cond3 then
35
- do
36
- local kColor = isaacAPIClassOrSerializedTable
37
- return copyKColor(nil, kColor, serializationType)
38
- end
39
- end
40
- ____cond3 = ____cond3 or ____switch3 == SerializableIsaacAPIClassType.RNG
41
- if ____cond3 then
42
- do
43
- local rng = isaacAPIClassOrSerializedTable
44
- return copyRNG(nil, rng)
45
- end
46
- end
47
- ____cond3 = ____cond3 or ____switch3 == SerializableIsaacAPIClassType.VECTOR
48
- if ____cond3 then
49
- do
50
- local vector = isaacAPIClassOrSerializedTable
51
- return copyVector(nil, vector)
52
- end
53
- end
54
- do
55
- do
56
- return ensureAllCases(nil, isaacAPIClassType)
57
- end
58
- end
59
- until true
13
+ local copyFunction = SERIALIZABLE_ISAAC_API_CLASS_TYPE_TO_COPY_FUNCTION[isaacAPIClassType]
14
+ if copyFunction == nil then
15
+ error(("Failed to copy Isaac API class \"" .. isaacAPIClassType) .. "\" since there is not a defined copy function for this class type.")
16
+ end
17
+ return copyFunction(nil, isaacAPIClassOrSerializedTable, serializationType)
60
18
  end
61
19
  function ____exports.isSerializedIsaacAPIClass(self, object)
62
20
  local objectType = type(object)
63
21
  if objectType ~= "table" then
64
22
  return false
65
23
  end
66
- local serializableIsaacAPIClassTypes = getEnumValues(nil, SerializableIsaacAPIClassType)
67
- for ____, serializableIsaacAPIClassType in ipairs(serializableIsaacAPIClassTypes) do
68
- repeat
69
- local ____switch12 = serializableIsaacAPIClassType
70
- local ____cond12 = ____switch12 == SerializableIsaacAPIClassType.COLOR
71
- if ____cond12 then
72
- do
73
- if isSerializedColor(nil, object) then
74
- return true
75
- end
76
- break
77
- end
78
- end
79
- ____cond12 = ____cond12 or ____switch12 == SerializableIsaacAPIClassType.KCOLOR
80
- if ____cond12 then
81
- do
82
- if isSerializedKColor(nil, object) then
83
- return true
84
- end
85
- break
86
- end
87
- end
88
- ____cond12 = ____cond12 or ____switch12 == SerializableIsaacAPIClassType.RNG
89
- if ____cond12 then
90
- do
91
- if isSerializedRNG(nil, object) then
92
- return true
93
- end
94
- break
95
- end
96
- end
97
- ____cond12 = ____cond12 or ____switch12 == SerializableIsaacAPIClassType.VECTOR
98
- if ____cond12 then
99
- do
100
- if isSerializedVector(nil, object) then
101
- return true
102
- end
103
- break
104
- end
105
- end
106
- do
107
- do
108
- ensureAllCases(nil, serializableIsaacAPIClassType)
109
- end
110
- end
111
- until true
112
- end
113
- return false
24
+ local identityFunctions = __TS__ObjectValues(SERIALIZABLE_ISAAC_API_CLASS_TYPE_TO_IDENTITY_FUNCTION)
25
+ return __TS__ArraySome(
26
+ identityFunctions,
27
+ function(____, identityFunction) return identityFunction(nil, object) end
28
+ )
114
29
  end
115
30
  return ____exports
@@ -0,0 +1,5 @@
1
+ import { SerializableIsaacAPIClassType } from "../enums/private/SerializableIsaacAPIClassType";
2
+ import { SerializationType } from "../enums/SerializationType";
3
+ export declare const SERIALIZABLE_ISAAC_API_CLASS_TYPE_TO_COPY_FUNCTION: {
4
+ readonly [key in SerializableIsaacAPIClassType]: (object: unknown, serializationType: SerializationType) => boolean;
5
+ };
@@ -0,0 +1,14 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ local ____SerializableIsaacAPIClassType = require("enums.private.SerializableIsaacAPIClassType")
4
+ local SerializableIsaacAPIClassType = ____SerializableIsaacAPIClassType.SerializableIsaacAPIClassType
5
+ local ____color = require("functions.color")
6
+ local copyColor = ____color.copyColor
7
+ local ____kColor = require("functions.kColor")
8
+ local copyKColor = ____kColor.copyKColor
9
+ local ____rng = require("functions.rng")
10
+ local copyRNG = ____rng.copyRNG
11
+ local ____vector = require("functions.vector")
12
+ local copyVector = ____vector.copyVector
13
+ ____exports.SERIALIZABLE_ISAAC_API_CLASS_TYPE_TO_COPY_FUNCTION = {[SerializableIsaacAPIClassType.COLOR] = copyColor, [SerializableIsaacAPIClassType.KCOLOR] = copyKColor, [SerializableIsaacAPIClassType.RNG] = copyRNG, [SerializableIsaacAPIClassType.VECTOR] = copyVector}
14
+ return ____exports
@@ -0,0 +1,4 @@
1
+ import { SerializableIsaacAPIClassType } from "../enums/private/SerializableIsaacAPIClassType";
2
+ export declare const SERIALIZABLE_ISAAC_API_CLASS_TYPE_TO_IDENTITY_FUNCTION: {
3
+ readonly [key in SerializableIsaacAPIClassType]: (object: unknown) => boolean;
4
+ };
@@ -0,0 +1,14 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ local ____SerializableIsaacAPIClassType = require("enums.private.SerializableIsaacAPIClassType")
4
+ local SerializableIsaacAPIClassType = ____SerializableIsaacAPIClassType.SerializableIsaacAPIClassType
5
+ local ____color = require("functions.color")
6
+ local isColor = ____color.isColor
7
+ local ____kColor = require("functions.kColor")
8
+ local isKColor = ____kColor.isKColor
9
+ local ____rng = require("functions.rng")
10
+ local isRNG = ____rng.isRNG
11
+ local ____vector = require("functions.vector")
12
+ local isVector = ____vector.isVector
13
+ ____exports.SERIALIZABLE_ISAAC_API_CLASS_TYPE_TO_IDENTITY_FUNCTION = {[SerializableIsaacAPIClassType.COLOR] = isColor, [SerializableIsaacAPIClassType.KCOLOR] = isKColor, [SerializableIsaacAPIClassType.RNG] = isRNG, [SerializableIsaacAPIClassType.VECTOR] = isVector}
14
+ return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.223",
3
+ "version": "1.2.224",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",