isaacscript-common 87.6.1 → 87.7.0
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.
- package/dist/functions/array.d.ts +3 -17
- package/dist/functions/array.d.ts.map +1 -1
- package/dist/functions/array.js +12 -30
- package/dist/functions/array.lua +43 -59
- package/dist/functions/debugFunctions.d.ts.map +1 -1
- package/dist/functions/debugFunctions.js +0 -1
- package/dist/functions/logMisc.lua +0 -1
- package/dist/functions/map.d.ts +1 -1
- package/dist/functions/map.d.ts.map +1 -1
- package/dist/functions/map.js +0 -1
- package/dist/functions/set.d.ts +1 -1
- package/dist/functions/set.d.ts.map +1 -1
- package/dist/functions/set.js +0 -4
- package/dist/functions/sort.d.ts.map +1 -1
- package/dist/functions/sort.js +0 -1
- package/dist/functions/utils.d.ts +11 -1
- package/dist/functions/utils.d.ts.map +1 -1
- package/dist/functions/utils.js +19 -1
- package/dist/functions/utils.lua +17 -1
- package/dist/index.rollup.d.ts +17 -21
- package/dist/isaacscript-common.lua +8741 -8707
- package/dist/tsdoc-metadata.json +1 -1
- package/package.json +5 -5
- package/src/functions/array.ts +8 -32
- package/src/functions/debugFunctions.ts +0 -1
- package/src/functions/map.ts +1 -2
- package/src/functions/set.ts +6 -5
- package/src/functions/sort.ts +1 -1
- package/src/functions/utils.ts +19 -1
|
@@ -9,25 +9,11 @@ export declare function arrayEquals<T>(array1: readonly T[], array2: readonly T[
|
|
|
9
9
|
* array. If the specified element(s) are not found in the array, it will simply return a shallow
|
|
10
10
|
* copy of the array.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* If there is more than one matching element in the array, this function will only remove the first
|
|
15
|
-
* matching element. If you want to remove all of the elements, use the `arrayRemoveAll` function
|
|
16
|
-
* instead.
|
|
17
|
-
*/
|
|
18
|
-
export declare function arrayRemove<T>(originalArray: readonly T[], ...elementsToRemove: readonly T[]): T[];
|
|
19
|
-
/**
|
|
20
|
-
* Shallow copies and removes the specified element(s) from the array. Returns the copied array. If
|
|
21
|
-
* the specified element(s) are not found in the array, it will simply return a shallow copy of the
|
|
22
|
-
* array.
|
|
12
|
+
* If there is more than one matching element in the array, this function will remove all of them.
|
|
23
13
|
*
|
|
24
14
|
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
25
|
-
*
|
|
26
|
-
* If there is more than one matching element in the array, this function will remove every matching
|
|
27
|
-
* element. If you want to only remove the first matching element, use the `arrayRemove` function
|
|
28
|
-
* instead.
|
|
29
15
|
*/
|
|
30
|
-
export declare function
|
|
16
|
+
export declare function arrayRemove<T>(originalArray: readonly T[], ...elementsToRemove: readonly T[]): T[];
|
|
31
17
|
/**
|
|
32
18
|
* Removes all of the specified element(s) from the array. If the specified element(s) are not found
|
|
33
19
|
* in the array, this function will do nothing.
|
|
@@ -101,7 +87,7 @@ export declare function emptyArray(array: unknown[]): void;
|
|
|
101
87
|
* This is named `filterMap` after the Rust function:
|
|
102
88
|
* https://doc.rust-lang.org/std/iter/struct.FilterMap.html
|
|
103
89
|
*/
|
|
104
|
-
export declare function filterMap<OldT, NewT>(array: readonly OldT[], func: (element: OldT) => NewT | undefined): NewT[];
|
|
90
|
+
export declare function filterMap<OldT, NewT>(array: readonly OldT[], func: (element: OldT) => NewT | undefined): readonly NewT[];
|
|
105
91
|
/**
|
|
106
92
|
* Helper function to get all possible combinations of the given array. This includes the
|
|
107
93
|
* combination of an empty array.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/functions/array.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAO1D;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,MAAM,EAAE,SAAS,CAAC,EAAE,EACpB,MAAM,EAAE,SAAS,CAAC,EAAE,GACnB,OAAO,CAST;AAED
|
|
1
|
+
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["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;GAYG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,aAAa,EAAE,SAAS,CAAC,EAAE,EAC3B,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,GAEhC,CAAC,EAAE,CAKL;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAEjC,KAAK,EAAE,OAAO,EAAE,EAChB,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,GAChC,IAAI,CAWN;AAED,+DAA+D;AAC/D,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAEzD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAE/B,KAAK,EAAE,OAAO,EAAE,EAChB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR,IAAI,CAMN"}
|
package/dist/functions/array.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.arrayEquals = arrayEquals;
|
|
4
4
|
exports.arrayRemove = arrayRemove;
|
|
5
|
-
exports.arrayRemoveAll = arrayRemoveAll;
|
|
6
5
|
exports.arrayRemoveAllInPlace = arrayRemoveAllInPlace;
|
|
7
6
|
exports.arrayRemoveInPlace = arrayRemoveInPlace;
|
|
8
7
|
exports.arrayRemoveIndex = arrayRemoveIndex;
|
|
@@ -54,14 +53,13 @@ function arrayEquals(array1, array2) {
|
|
|
54
53
|
* array. If the specified element(s) are not found in the array, it will simply return a shallow
|
|
55
54
|
* copy of the array.
|
|
56
55
|
*
|
|
57
|
-
*
|
|
56
|
+
* If there is more than one matching element in the array, this function will remove all of them.
|
|
58
57
|
*
|
|
59
|
-
*
|
|
60
|
-
* matching element. If you want to remove all of the elements, use the `arrayRemoveAll` function
|
|
61
|
-
* instead.
|
|
58
|
+
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
62
59
|
*/
|
|
60
|
+
function arrayRemove(originalArray, ...elementsToRemove
|
|
63
61
|
// eslint-disable-next-line complete/no-mutable-return
|
|
64
|
-
|
|
62
|
+
) {
|
|
65
63
|
const elementsToRemoveSet = new ReadonlySet_1.ReadonlySet(elementsToRemove);
|
|
66
64
|
const array = [];
|
|
67
65
|
for (const element of originalArray) {
|
|
@@ -71,23 +69,6 @@ function arrayRemove(originalArray, ...elementsToRemove) {
|
|
|
71
69
|
}
|
|
72
70
|
return array;
|
|
73
71
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Shallow copies and removes the specified element(s) from the array. Returns the copied array. If
|
|
76
|
-
* the specified element(s) are not found in the array, it will simply return a shallow copy of the
|
|
77
|
-
* array.
|
|
78
|
-
*
|
|
79
|
-
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
80
|
-
*
|
|
81
|
-
* If there is more than one matching element in the array, this function will remove every matching
|
|
82
|
-
* element. If you want to only remove the first matching element, use the `arrayRemove` function
|
|
83
|
-
* instead.
|
|
84
|
-
*/
|
|
85
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
86
|
-
function arrayRemoveAll(originalArray, ...elementsToRemove) {
|
|
87
|
-
const array = copyArray(originalArray);
|
|
88
|
-
arrayRemoveAllInPlace(array, ...elementsToRemove);
|
|
89
|
-
return array;
|
|
90
|
-
}
|
|
91
72
|
/**
|
|
92
73
|
* Removes all of the specified element(s) from the array. If the specified element(s) are not found
|
|
93
74
|
* in the array, this function will do nothing.
|
|
@@ -128,10 +109,11 @@ array, ...elementsToRemove) {
|
|
|
128
109
|
*
|
|
129
110
|
* @returns The removed elements. This will be an empty array if no elements were removed.
|
|
130
111
|
*/
|
|
131
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
132
112
|
function arrayRemoveInPlace(
|
|
133
113
|
// eslint-disable-next-line complete/prefer-readonly-parameter-types
|
|
134
|
-
array, ...elementsToRemove
|
|
114
|
+
array, ...elementsToRemove
|
|
115
|
+
// eslint-disable-next-line complete/no-mutable-return
|
|
116
|
+
) {
|
|
135
117
|
const removedElements = [];
|
|
136
118
|
for (const element of elementsToRemove) {
|
|
137
119
|
const index = array.indexOf(element);
|
|
@@ -149,8 +131,9 @@ array, ...elementsToRemove) {
|
|
|
149
131
|
*
|
|
150
132
|
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
151
133
|
*/
|
|
134
|
+
function arrayRemoveIndex(originalArray, ...indexesToRemove
|
|
152
135
|
// eslint-disable-next-line complete/no-mutable-return
|
|
153
|
-
|
|
136
|
+
) {
|
|
154
137
|
const indexesToRemoveSet = new ReadonlySet_1.ReadonlySet(indexesToRemove);
|
|
155
138
|
const array = [];
|
|
156
139
|
for (const [i, element] of originalArray.entries()) {
|
|
@@ -168,10 +151,11 @@ function arrayRemoveIndex(originalArray, ...indexesToRemove) {
|
|
|
168
151
|
*
|
|
169
152
|
* @returns The removed elements. This will be an empty array if no elements were removed.
|
|
170
153
|
*/
|
|
171
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
172
154
|
function arrayRemoveIndexInPlace(
|
|
173
155
|
// eslint-disable-next-line complete/prefer-readonly-parameter-types
|
|
174
|
-
array, ...indexesToRemove
|
|
156
|
+
array, ...indexesToRemove
|
|
157
|
+
// eslint-disable-next-line complete/no-mutable-return
|
|
158
|
+
) {
|
|
175
159
|
const legalIndexes = indexesToRemove.filter((i) => i >= 0 && i < array.length);
|
|
176
160
|
if (legalIndexes.length === 0) {
|
|
177
161
|
return [];
|
|
@@ -248,7 +232,6 @@ function emptyArray(array) {
|
|
|
248
232
|
* This is named `filterMap` after the Rust function:
|
|
249
233
|
* https://doc.rust-lang.org/std/iter/struct.FilterMap.html
|
|
250
234
|
*/
|
|
251
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
252
235
|
function filterMap(array, func) {
|
|
253
236
|
const filteredArray = [];
|
|
254
237
|
for (const element of array) {
|
|
@@ -538,7 +521,6 @@ function setAllArrayElements(array, value) {
|
|
|
538
521
|
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
539
522
|
* a random seed.
|
|
540
523
|
*/
|
|
541
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
542
524
|
function shuffleArray(originalArray, seedOrRNG) {
|
|
543
525
|
const array = copyArray(originalArray);
|
|
544
526
|
shuffleArrayInPlace(array, seedOrRNG);
|
package/dist/functions/array.lua
CHANGED
|
@@ -37,52 +37,6 @@ local isTable = ____types.isTable
|
|
|
37
37
|
local ____utils = require("functions.utils")
|
|
38
38
|
local assertDefined = ____utils.assertDefined
|
|
39
39
|
local eRange = ____utils.eRange
|
|
40
|
-
--- Removes all of the specified element(s) from the array. If the specified element(s) are not found
|
|
41
|
-
-- in the array, this function will do nothing.
|
|
42
|
-
--
|
|
43
|
-
-- This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
44
|
-
--
|
|
45
|
-
-- If there is more than one matching element in the array, this function will remove every matching
|
|
46
|
-
-- element. If you want to only remove the first matching element, use the `arrayRemoveInPlace`
|
|
47
|
-
-- function instead.
|
|
48
|
-
--
|
|
49
|
-
-- @returns True if one or more elements were removed, false otherwise.
|
|
50
|
-
function ____exports.arrayRemoveAllInPlace(self, array, ...)
|
|
51
|
-
local elementsToRemove = {...}
|
|
52
|
-
local removedOneOrMoreElements = false
|
|
53
|
-
for ____, element in ipairs(elementsToRemove) do
|
|
54
|
-
local index
|
|
55
|
-
repeat
|
|
56
|
-
do
|
|
57
|
-
index = __TS__ArrayIndexOf(array, element)
|
|
58
|
-
if index > -1 then
|
|
59
|
-
removedOneOrMoreElements = true
|
|
60
|
-
__TS__ArraySplice(array, index, 1)
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
until not (index > -1)
|
|
64
|
-
end
|
|
65
|
-
return removedOneOrMoreElements
|
|
66
|
-
end
|
|
67
|
-
--- Helper function to perform a shallow copy.
|
|
68
|
-
--
|
|
69
|
-
-- @param oldArray The array to copy.
|
|
70
|
-
-- @param numElements Optional. If specified, will only copy the first N elements. By default, the
|
|
71
|
-
-- entire array will be copied.
|
|
72
|
-
function ____exports.copyArray(self, oldArray, numElements)
|
|
73
|
-
if numElements == nil then
|
|
74
|
-
return {table.unpack(oldArray)}
|
|
75
|
-
end
|
|
76
|
-
local newArrayWithFirstNElements = {}
|
|
77
|
-
do
|
|
78
|
-
local i = 0
|
|
79
|
-
while i < numElements do
|
|
80
|
-
newArrayWithFirstNElements[#newArrayWithFirstNElements + 1] = oldArray[i + 1]
|
|
81
|
-
i = i + 1
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
return newArrayWithFirstNElements
|
|
85
|
-
end
|
|
86
40
|
function addCombinations(self, n, src, got, all)
|
|
87
41
|
if n == 0 then
|
|
88
42
|
if #got > 0 then
|
|
@@ -178,11 +132,9 @@ end
|
|
|
178
132
|
-- array. If the specified element(s) are not found in the array, it will simply return a shallow
|
|
179
133
|
-- copy of the array.
|
|
180
134
|
--
|
|
181
|
-
--
|
|
135
|
+
-- If there is more than one matching element in the array, this function will remove all of them.
|
|
182
136
|
--
|
|
183
|
-
--
|
|
184
|
-
-- matching element. If you want to remove all of the elements, use the `arrayRemoveAll` function
|
|
185
|
-
-- instead.
|
|
137
|
+
-- This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
186
138
|
function ____exports.arrayRemove(self, originalArray, ...)
|
|
187
139
|
local elementsToRemove = {...}
|
|
188
140
|
local elementsToRemoveSet = __TS__New(ReadonlySet, elementsToRemove)
|
|
@@ -194,19 +146,32 @@ function ____exports.arrayRemove(self, originalArray, ...)
|
|
|
194
146
|
end
|
|
195
147
|
return array
|
|
196
148
|
end
|
|
197
|
-
---
|
|
198
|
-
--
|
|
199
|
-
-- array.
|
|
149
|
+
--- Removes all of the specified element(s) from the array. If the specified element(s) are not found
|
|
150
|
+
-- in the array, this function will do nothing.
|
|
200
151
|
--
|
|
201
152
|
-- This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
202
153
|
--
|
|
203
154
|
-- If there is more than one matching element in the array, this function will remove every matching
|
|
204
|
-
-- element. If you want to only remove the first matching element, use the `
|
|
205
|
-
-- instead.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
155
|
+
-- element. If you want to only remove the first matching element, use the `arrayRemoveInPlace`
|
|
156
|
+
-- function instead.
|
|
157
|
+
--
|
|
158
|
+
-- @returns True if one or more elements were removed, false otherwise.
|
|
159
|
+
function ____exports.arrayRemoveAllInPlace(self, array, ...)
|
|
160
|
+
local elementsToRemove = {...}
|
|
161
|
+
local removedOneOrMoreElements = false
|
|
162
|
+
for ____, element in ipairs(elementsToRemove) do
|
|
163
|
+
local index
|
|
164
|
+
repeat
|
|
165
|
+
do
|
|
166
|
+
index = __TS__ArrayIndexOf(array, element)
|
|
167
|
+
if index > -1 then
|
|
168
|
+
removedOneOrMoreElements = true
|
|
169
|
+
__TS__ArraySplice(array, index, 1)
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
until not (index > -1)
|
|
173
|
+
end
|
|
174
|
+
return removedOneOrMoreElements
|
|
210
175
|
end
|
|
211
176
|
--- Removes the specified element(s) from the array. If the specified element(s) are not found in the
|
|
212
177
|
-- array, this function will do nothing.
|
|
@@ -303,6 +268,25 @@ function ____exports.combineArrays(self, ...)
|
|
|
303
268
|
end
|
|
304
269
|
return elements
|
|
305
270
|
end
|
|
271
|
+
--- Helper function to perform a shallow copy.
|
|
272
|
+
--
|
|
273
|
+
-- @param oldArray The array to copy.
|
|
274
|
+
-- @param numElements Optional. If specified, will only copy the first N elements. By default, the
|
|
275
|
+
-- entire array will be copied.
|
|
276
|
+
function ____exports.copyArray(self, oldArray, numElements)
|
|
277
|
+
if numElements == nil then
|
|
278
|
+
return {table.unpack(oldArray)}
|
|
279
|
+
end
|
|
280
|
+
local newArrayWithFirstNElements = {}
|
|
281
|
+
do
|
|
282
|
+
local i = 0
|
|
283
|
+
while i < numElements do
|
|
284
|
+
newArrayWithFirstNElements[#newArrayWithFirstNElements + 1] = oldArray[i + 1]
|
|
285
|
+
i = i + 1
|
|
286
|
+
end
|
|
287
|
+
end
|
|
288
|
+
return newArrayWithFirstNElements
|
|
289
|
+
end
|
|
306
290
|
--- Helper function to remove all of the elements in an array in-place.
|
|
307
291
|
function ____exports.emptyArray(self, array)
|
|
308
292
|
__TS__ArraySplice(array, 0)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugFunctions.d.ts","sourceRoot":"","sources":["../../src/functions/debugFunctions.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,GAAG,GAAG,KAAK,EACjB,oBAAoB,UAAO,GAC1B,GAAG,CAEL;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CAAC,oBAAoB,UAAO,GAAG,GAAG,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"debugFunctions.d.ts","sourceRoot":"","sources":["../../src/functions/debugFunctions.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,GAAG,GAAG,KAAK,EACjB,oBAAoB,UAAO,GAC1B,GAAG,CAEL;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CAAC,oBAAoB,UAAO,GAAG,GAAG,GAAG,KAAK,CAmBhE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAa/C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAI3C;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAG1C"}
|
|
@@ -43,7 +43,6 @@ function getTime(useSocketIfAvailable = true) {
|
|
|
43
43
|
return SandboxGetTime();
|
|
44
44
|
}
|
|
45
45
|
if (isLuaDebugEnabled()) {
|
|
46
|
-
// eslint-disable-next-line unicorn/prefer-module
|
|
47
46
|
const [ok, requiredSocket] = pcall(require, "socket");
|
|
48
47
|
if (ok) {
|
|
49
48
|
const socket = requiredSocket;
|
|
@@ -6,7 +6,6 @@ local __TS__Iterator = ____lualib.__TS__Iterator
|
|
|
6
6
|
local __TS__TypeOf = ____lualib.__TS__TypeOf
|
|
7
7
|
local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
|
|
8
8
|
local __TS__New = ____lualib.__TS__New
|
|
9
|
-
local Set = ____lualib.Set
|
|
10
9
|
local ____exports = {}
|
|
11
10
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
12
11
|
local BossID = ____isaac_2Dtypescript_2Ddefinitions.BossID
|
package/dist/functions/map.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export declare function mapSetHash<V>(map: Map<PtrHash, V>, entity: Entity, valu
|
|
|
54
54
|
*
|
|
55
55
|
* Also see the `objectToReadonlyMap` function.
|
|
56
56
|
*/
|
|
57
|
-
export declare function objectToMap<K extends string | number | symbol, V>(object: Record<K, V>):
|
|
57
|
+
export declare function objectToMap<K extends string | number | symbol, V>(object: Record<K, V>): ReadonlyMap<K, V>;
|
|
58
58
|
/**
|
|
59
59
|
* Helper function to convert an object to a read-only map.
|
|
60
60
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/functions/map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGxD,mGAAmG;AAEnG,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAOlE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE,EACtD,GAAG,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,EAC9B,MAAM,EAAE,MAAM,EACd,GAAG,SAAS,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C,GACP,IAAI,CAEN;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,EACjC,GAAG,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,GACrB,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAQnB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAE1B,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,EACpB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,CAAC,GACP,IAAI,CAGN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,EAC/D,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAQnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,EACvE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAEnB;AAED,4DAA4D;AAC5D,wBAAgB,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,MAAM,CAGhE"}
|
package/dist/functions/map.js
CHANGED
package/dist/functions/set.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare function addSetsToSet<T>(mainSet: Set<T>, ...setsToAdd: ReadonlyA
|
|
|
10
10
|
*
|
|
11
11
|
* This function is variadic, meaning that you can specify N sets.
|
|
12
12
|
*/
|
|
13
|
-
export declare function combineSets<T>(...sets: ReadonlyArray<ReadonlySet<T>>):
|
|
13
|
+
export declare function combineSets<T>(...sets: ReadonlyArray<ReadonlySet<T>>): ReadonlySet<T>;
|
|
14
14
|
/** Helper function to copy a set. (You can also use a Set constructor to accomplish this task.) */
|
|
15
15
|
export declare function copySet<T>(oldSet: ReadonlySet<T>): Set<T>;
|
|
16
16
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/functions/set.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAE5B,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EACf,GAAG,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAC1C,IAAI,CAMN;AAED;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/functions/set.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAE5B,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EACf,GAAG,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAC1C,IAAI,CAMN;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,GAAG,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GACrC,WAAW,CAAC,CAAC,CAAC,CAShB;AAED,mGAAmG;AAEnG,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAOzD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAEjC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EACf,GAAG,YAAY,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAC7C,IAAI,CAMN;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAC3D,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,EACnB,SAA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EH,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI,CAItE;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,CAAC,EACtB,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,EACnB,GAAG,QAAQ,EAAE,SAAS,CAAC,EAAE,GACxB,OAAO,CAET;AAED,4DAA4D;AAC5D,wBAAgB,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,CAGvD"}
|
package/dist/functions/set.js
CHANGED
|
@@ -38,7 +38,6 @@ mainSet, ...setsToAdd) {
|
|
|
38
38
|
*
|
|
39
39
|
* This function is variadic, meaning that you can specify N sets.
|
|
40
40
|
*/
|
|
41
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
42
41
|
function combineSets(...sets) {
|
|
43
42
|
const newSet = new Set();
|
|
44
43
|
for (const set of sets) {
|
|
@@ -118,7 +117,6 @@ function getSetCombinations(set, includeEmptyArray) {
|
|
|
118
117
|
* Normally, set values are returned in insertion order, so use this function when the ordering of
|
|
119
118
|
* the contents is important.
|
|
120
119
|
*/
|
|
121
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
122
120
|
function getSortedSetValues(set) {
|
|
123
121
|
const values = [...set];
|
|
124
122
|
// Check for problematic types in order to throw a helpful error message.
|
|
@@ -151,7 +149,6 @@ function objectKeysToReadonlySet(object) {
|
|
|
151
149
|
*
|
|
152
150
|
* Also see the `objectKeysToReadonlySet` function.
|
|
153
151
|
*/
|
|
154
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
155
152
|
function objectKeysToSet(object) {
|
|
156
153
|
const set = new Set();
|
|
157
154
|
for (const key of Object.keys(object)) {
|
|
@@ -178,7 +175,6 @@ function objectValuesToReadonlySet(object) {
|
|
|
178
175
|
*
|
|
179
176
|
* Also see the `objectValuesToReadonlySet` function.
|
|
180
177
|
*/
|
|
181
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
182
178
|
function objectValuesToSet(object) {
|
|
183
179
|
const set = new Set();
|
|
184
180
|
for (const key of Object.values(object)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../src/functions/sort.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CA0B7D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,IACtC,GAAG,OAAO,EAAE,GAAG,OAAO,KAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAsB5C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EACvC,CAAC,EAAE,SAAS,CAAC,EAAE,EACf,CAAC,EAAE,SAAS,CAAC,EAAE,GACd,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAiDZ;AAED;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../src/functions/sort.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CA0B7D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,IACtC,GAAG,OAAO,EAAE,GAAG,OAAO,KAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAsB5C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EACvC,CAAC,EAAE,SAAS,CAAC,EAAE,EACf,CAAC,EAAE,SAAS,CAAC,EAAE,GACd,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAiDZ;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAE1B,KAAK,EAAE,CAAC,EAAE,EACV,QAAQ,GAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAc,GAEhD,CAAC,EAAE,CAuDL"}
|
package/dist/functions/sort.js
CHANGED
|
@@ -105,7 +105,6 @@ function sortTwoDimensionalArray(a, b) {
|
|
|
105
105
|
*
|
|
106
106
|
* Under the hood, this uses the merge sort algorithm.
|
|
107
107
|
*/
|
|
108
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
109
108
|
function stableSort(
|
|
110
109
|
// eslint-disable-next-line complete/prefer-readonly-parameter-types
|
|
111
110
|
array, sortFunc = sortNormal) {
|
|
@@ -88,7 +88,7 @@ export declare function inRange(num: int, start: int, end: int): boolean;
|
|
|
88
88
|
*/
|
|
89
89
|
export declare function isMultiplayer(): boolean;
|
|
90
90
|
/**
|
|
91
|
-
* Helper function to check if the player
|
|
91
|
+
* Helper function to check if the player has the Repentance DLC installed.
|
|
92
92
|
*
|
|
93
93
|
* This function should always be used over the `REPENTANCE` constant, since the latter is not safe.
|
|
94
94
|
*
|
|
@@ -96,6 +96,16 @@ export declare function isMultiplayer(): boolean;
|
|
|
96
96
|
* https://bindingofisaacrebirth.fandom.com/wiki/V1.06.J818#Lua_Changes
|
|
97
97
|
*/
|
|
98
98
|
export declare function isRepentance(): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Helper function to check if the player has the Repentance+ DLC installed.
|
|
101
|
+
*
|
|
102
|
+
* This function should always be used over the `REPENTANCE_PLUS` constant, since the latter is not
|
|
103
|
+
* safe.
|
|
104
|
+
*
|
|
105
|
+
* Specifically, this function checks for `Room:DamageGridWithSource` method:
|
|
106
|
+
* https://bindingofisaacrebirth.wiki.gg/wiki/The_Binding_of_Isaac:_Repentance%2B#Modding_Changes
|
|
107
|
+
*/
|
|
108
|
+
export declare function isRepentancePlus(): boolean;
|
|
99
109
|
/**
|
|
100
110
|
* Helper function to check if the player is using REPENTOGON, an exe-hack which expands the modding
|
|
101
111
|
* API.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/functions/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/functions/utils.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,CAAC,EACR,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,GAC7B,CAAC,MAAM,CAAC,GACR;IACE,iFAAiF;CAClF,GACJ,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,CAAC,EAAE,SAAS,CAAC,CAIxC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,CAAC,EACR,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GACxB,CAAC,MAAM,CAAC,GACR;IACE,4EAA4E;CAC7E,GACJ,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAInC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,SAAS,SAAI,GAAG,SAAS,GAAG,EAAE,CAY3E;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,OAAO,EACZ,oBAAoB,EAAE,MAAM,GAC3B,MAAM,CAQR;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,SAAS,SAAI,GAAG,SAAS,GAAG,EAAE,CAO3E;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAE/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAMvC;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAiBtC;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAM1C;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAiBtC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAI7D;AAED;;;;;;;;;;;;;;GAcG;AAEH,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAAG"}
|
package/dist/functions/utils.js
CHANGED
|
@@ -8,9 +8,11 @@ exports.iRange = iRange;
|
|
|
8
8
|
exports.inRange = inRange;
|
|
9
9
|
exports.isMultiplayer = isMultiplayer;
|
|
10
10
|
exports.isRepentance = isRepentance;
|
|
11
|
+
exports.isRepentancePlus = isRepentancePlus;
|
|
11
12
|
exports.isRepentogon = isRepentogon;
|
|
12
13
|
exports.repeat = repeat;
|
|
13
14
|
exports.todo = todo;
|
|
15
|
+
const cachedClasses_1 = require("../core/cachedClasses");
|
|
14
16
|
const ReadonlySet_1 = require("../types/ReadonlySet");
|
|
15
17
|
const playerIndex_1 = require("./playerIndex");
|
|
16
18
|
const types_1 = require("./types");
|
|
@@ -136,7 +138,7 @@ function isMultiplayer() {
|
|
|
136
138
|
return controllerIndexesSet.size > 1;
|
|
137
139
|
}
|
|
138
140
|
/**
|
|
139
|
-
* Helper function to check if the player
|
|
141
|
+
* Helper function to check if the player has the Repentance DLC installed.
|
|
140
142
|
*
|
|
141
143
|
* This function should always be used over the `REPENTANCE` constant, since the latter is not safe.
|
|
142
144
|
*
|
|
@@ -151,6 +153,22 @@ function isRepentance() {
|
|
|
151
153
|
const getAnimation = classTable.get("GetAnimation");
|
|
152
154
|
return (0, types_1.isFunction)(getAnimation);
|
|
153
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Helper function to check if the player has the Repentance+ DLC installed.
|
|
158
|
+
*
|
|
159
|
+
* This function should always be used over the `REPENTANCE_PLUS` constant, since the latter is not
|
|
160
|
+
* safe.
|
|
161
|
+
*
|
|
162
|
+
* Specifically, this function checks for `Room:DamageGridWithSource` method:
|
|
163
|
+
* https://bindingofisaacrebirth.wiki.gg/wiki/The_Binding_of_Isaac:_Repentance%2B#Modding_Changes
|
|
164
|
+
*/
|
|
165
|
+
function isRepentancePlus() {
|
|
166
|
+
const room = cachedClasses_1.game.GetRoom();
|
|
167
|
+
const metatable = getmetatable(room);
|
|
168
|
+
assertDefined(metatable, "Failed to get the metatable of the room class.");
|
|
169
|
+
const damageGridWithSource = metatable.get("DamageGridWithSource");
|
|
170
|
+
return (0, types_1.isFunction)(damageGridWithSource);
|
|
171
|
+
}
|
|
154
172
|
/**
|
|
155
173
|
* Helper function to check if the player is using REPENTOGON, an exe-hack which expands the modding
|
|
156
174
|
* API.
|
package/dist/functions/utils.lua
CHANGED
|
@@ -2,6 +2,8 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
4
|
local ____exports = {}
|
|
5
|
+
local ____cachedClasses = require("core.cachedClasses")
|
|
6
|
+
local game = ____cachedClasses.game
|
|
5
7
|
local ____ReadonlySet = require("types.ReadonlySet")
|
|
6
8
|
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
7
9
|
local ____playerIndex = require("functions.playerIndex")
|
|
@@ -134,7 +136,7 @@ function ____exports.isMultiplayer(self)
|
|
|
134
136
|
local controllerIndexesSet = __TS__New(ReadonlySet, controllerIndexes)
|
|
135
137
|
return controllerIndexesSet.size > 1
|
|
136
138
|
end
|
|
137
|
-
--- Helper function to check if the player
|
|
139
|
+
--- Helper function to check if the player has the Repentance DLC installed.
|
|
138
140
|
--
|
|
139
141
|
-- This function should always be used over the `REPENTANCE` constant, since the latter is not safe.
|
|
140
142
|
--
|
|
@@ -148,6 +150,20 @@ function ____exports.isRepentance(self)
|
|
|
148
150
|
local getAnimation = classTable.GetAnimation
|
|
149
151
|
return isFunction(nil, getAnimation)
|
|
150
152
|
end
|
|
153
|
+
--- Helper function to check if the player has the Repentance+ DLC installed.
|
|
154
|
+
--
|
|
155
|
+
-- This function should always be used over the `REPENTANCE_PLUS` constant, since the latter is not
|
|
156
|
+
-- safe.
|
|
157
|
+
--
|
|
158
|
+
-- Specifically, this function checks for `Room:DamageGridWithSource` method:
|
|
159
|
+
-- https://bindingofisaacrebirth.wiki.gg/wiki/The_Binding_of_Isaac:_Repentance%2B#Modding_Changes
|
|
160
|
+
function ____exports.isRepentancePlus(self)
|
|
161
|
+
local room = game:GetRoom()
|
|
162
|
+
local metatable = getmetatable(room)
|
|
163
|
+
____exports.assertDefined(nil, metatable, "Failed to get the metatable of the room class.")
|
|
164
|
+
local damageGridWithSource = metatable.DamageGridWithSource
|
|
165
|
+
return isFunction(nil, damageGridWithSource)
|
|
166
|
+
end
|
|
151
167
|
--- Helper function to check if the player is using REPENTOGON, an exe-hack which expands the modding
|
|
152
168
|
-- API.
|
|
153
169
|
--
|
package/dist/index.rollup.d.ts
CHANGED
|
@@ -1085,26 +1085,11 @@ export declare function arrayEquals<T>(array1: readonly T[], array2: readonly T[
|
|
|
1085
1085
|
* array. If the specified element(s) are not found in the array, it will simply return a shallow
|
|
1086
1086
|
* copy of the array.
|
|
1087
1087
|
*
|
|
1088
|
-
*
|
|
1089
|
-
*
|
|
1090
|
-
* If there is more than one matching element in the array, this function will only remove the first
|
|
1091
|
-
* matching element. If you want to remove all of the elements, use the `arrayRemoveAll` function
|
|
1092
|
-
* instead.
|
|
1093
|
-
*/
|
|
1094
|
-
export declare function arrayRemove<T>(originalArray: readonly T[], ...elementsToRemove: readonly T[]): T[];
|
|
1095
|
-
|
|
1096
|
-
/**
|
|
1097
|
-
* Shallow copies and removes the specified element(s) from the array. Returns the copied array. If
|
|
1098
|
-
* the specified element(s) are not found in the array, it will simply return a shallow copy of the
|
|
1099
|
-
* array.
|
|
1088
|
+
* If there is more than one matching element in the array, this function will remove all of them.
|
|
1100
1089
|
*
|
|
1101
1090
|
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
1102
|
-
*
|
|
1103
|
-
* If there is more than one matching element in the array, this function will remove every matching
|
|
1104
|
-
* element. If you want to only remove the first matching element, use the `arrayRemove` function
|
|
1105
|
-
* instead.
|
|
1106
1091
|
*/
|
|
1107
|
-
export declare function
|
|
1092
|
+
export declare function arrayRemove<T>(originalArray: readonly T[], ...elementsToRemove: readonly T[]): T[];
|
|
1108
1093
|
|
|
1109
1094
|
/**
|
|
1110
1095
|
* Removes all of the specified element(s) from the array. If the specified element(s) are not found
|
|
@@ -1705,7 +1690,7 @@ export declare function combineArrays<T>(...arrays: ReadonlyArray<readonly T[]>)
|
|
|
1705
1690
|
*
|
|
1706
1691
|
* This function is variadic, meaning that you can specify N sets.
|
|
1707
1692
|
*/
|
|
1708
|
-
export declare function combineSets<T>(...sets: ReadonlyArray<ReadonlySet<T>>):
|
|
1693
|
+
export declare function combineSets<T>(...sets: ReadonlyArray<ReadonlySet<T>>): ReadonlySet<T>;
|
|
1709
1694
|
|
|
1710
1695
|
/**
|
|
1711
1696
|
* Helper type to validate that a union of interfaces with a field of `type` that is based on an
|
|
@@ -4625,7 +4610,7 @@ export declare function filter<T>(array: readonly T[], func: (value: T, index: n
|
|
|
4625
4610
|
* This is named `filterMap` after the Rust function:
|
|
4626
4611
|
* https://doc.rust-lang.org/std/iter/struct.FilterMap.html
|
|
4627
4612
|
*/
|
|
4628
|
-
export declare function filterMap<OldT, NewT>(array: readonly OldT[], func: (element: OldT) => NewT | undefined): NewT[];
|
|
4613
|
+
export declare function filterMap<OldT, NewT>(array: readonly OldT[], func: (element: OldT) => NewT | undefined): readonly NewT[];
|
|
4629
4614
|
|
|
4630
4615
|
/**
|
|
4631
4616
|
* Helper function for non-TypeScript users to find an element in an array.
|
|
@@ -10051,7 +10036,7 @@ export declare function isRedKeyRoom(roomGridIndex: int): boolean;
|
|
|
10051
10036
|
export declare function isReflectionRender(): boolean;
|
|
10052
10037
|
|
|
10053
10038
|
/**
|
|
10054
|
-
* Helper function to check if the player
|
|
10039
|
+
* Helper function to check if the player has the Repentance DLC installed.
|
|
10055
10040
|
*
|
|
10056
10041
|
* This function should always be used over the `REPENTANCE` constant, since the latter is not safe.
|
|
10057
10042
|
*
|
|
@@ -10075,6 +10060,17 @@ export declare function isRepentanceBoss(bossID: BossID): boolean;
|
|
|
10075
10060
|
*/
|
|
10076
10061
|
export declare function isRepentanceDoor(door: GridEntityDoor): boolean;
|
|
10077
10062
|
|
|
10063
|
+
/**
|
|
10064
|
+
* Helper function to check if the player has the Repentance+ DLC installed.
|
|
10065
|
+
*
|
|
10066
|
+
* This function should always be used over the `REPENTANCE_PLUS` constant, since the latter is not
|
|
10067
|
+
* safe.
|
|
10068
|
+
*
|
|
10069
|
+
* Specifically, this function checks for `Room:DamageGridWithSource` method:
|
|
10070
|
+
* https://bindingofisaacrebirth.wiki.gg/wiki/The_Binding_of_Isaac:_Repentance%2B#Modding_Changes
|
|
10071
|
+
*/
|
|
10072
|
+
export declare function isRepentancePlus(): boolean;
|
|
10073
|
+
|
|
10078
10074
|
/**
|
|
10079
10075
|
* Helper function to check if the provided stage type is equal to `StageType.REPENTANCE` or
|
|
10080
10076
|
* `StageType.REPENTANCE_B`.
|
|
@@ -15127,7 +15123,7 @@ export declare function objectKeysToSet<K extends string | number | symbol, V>(o
|
|
|
15127
15123
|
*
|
|
15128
15124
|
* Also see the `objectToReadonlyMap` function.
|
|
15129
15125
|
*/
|
|
15130
|
-
export declare function objectToMap<K extends string | number | symbol, V>(object: Record<K, V>):
|
|
15126
|
+
export declare function objectToMap<K extends string | number | symbol, V>(object: Record<K, V>): ReadonlyMap<K, V>;
|
|
15131
15127
|
|
|
15132
15128
|
/**
|
|
15133
15129
|
* Helper function to convert an object to a read-only map.
|