isaacscript-common 4.9.0 → 4.9.1

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.
@@ -63,7 +63,6 @@ export declare function emptyArray<T>(array: T[]): void;
63
63
  * For example, if this function is provided an array containing 1, 2, and 3, then it will return an
64
64
  * array containing the following arrays:
65
65
  *
66
- * - []
67
66
  * - [1]
68
67
  * - [2]
69
68
  * - [3]
@@ -75,11 +74,12 @@ export declare function emptyArray<T>(array: T[]): void;
75
74
  * From: https://github.com/firstandthird/combinations/blob/master/index.js
76
75
  *
77
76
  * @param array The array to get the combinations of.
77
+ * @param includeEmptyArray Whether or not to include an empty array in the combinations.
78
78
  * @param min Optional. The minimum number of elements to include in each combination. Default is 1.
79
79
  * @param max Optional. The maximum number of elements to include in each combination. Default is
80
80
  * the length of the array.
81
81
  */
82
- export declare function getArrayCombinations<T>(array: T[] | readonly T[], min?: int, max?: int): ReadonlyArray<readonly T[]>;
82
+ export declare function getArrayCombinations<T>(array: T[] | readonly T[], includeEmptyArray: boolean, min?: int, max?: int): ReadonlyArray<readonly T[]>;
83
83
  /**
84
84
  * Helper function to get an array containing the indexes of an array.
85
85
  *
@@ -214,7 +214,6 @@ end
214
214
  -- For example, if this function is provided an array containing 1, 2, and 3, then it will return an
215
215
  -- array containing the following arrays:
216
216
  --
217
- -- - []
218
217
  -- - [1]
219
218
  -- - [2]
220
219
  -- - [3]
@@ -226,10 +225,11 @@ end
226
225
  -- From: https://github.com/firstandthird/combinations/blob/master/index.js
227
226
  --
228
227
  -- @param array The array to get the combinations of.
228
+ -- @param includeEmptyArray Whether or not to include an empty array in the combinations.
229
229
  -- @param min Optional. The minimum number of elements to include in each combination. Default is 1.
230
230
  -- @param max Optional. The maximum number of elements to include in each combination. Default is
231
231
  -- the length of the array.
232
- function ____exports.getArrayCombinations(self, array, min, max)
232
+ function ____exports.getArrayCombinations(self, array, includeEmptyArray, min, max)
233
233
  if min == nil or min <= 0 then
234
234
  min = 1
235
235
  end
@@ -276,7 +276,9 @@ function ____exports.getArrayCombinations(self, array, min, max)
276
276
  if #array == max then
277
277
  all[#all + 1] = array
278
278
  end
279
- __TS__ArrayUnshift(all, {})
279
+ if includeEmptyArray then
280
+ __TS__ArrayUnshift(all, {})
281
+ end
280
282
  return all
281
283
  end
282
284
  --- Helper function to get an array containing the indexes of an array.
@@ -46,8 +46,11 @@ export declare function getRandomSetElement<T>(set: Set<T> | ReadonlySet<T>, see
46
46
  * - [1, 3]
47
47
  * - [2, 3]
48
48
  * - [1, 2, 3]
49
+ *
50
+ * @param set The set to get the combinations of.
51
+ * @param includeEmptyArray Whether or not to include an empty array in the combinations.
49
52
  */
50
- export declare function getSetCombinations<T>(set: Set<T> | ReadonlySet<T>): ReadonlyArray<ReadonlySet<T>>;
53
+ export declare function getSetCombinations<T>(set: Set<T> | ReadonlySet<T>, includeEmptyArray: boolean): ReadonlyArray<ReadonlySet<T>>;
51
54
  /**
52
55
  * Helper function to get a sorted array based on the contents of a set.
53
56
  *
package/functions/set.lua CHANGED
@@ -96,9 +96,12 @@ end
96
96
  -- - [1, 3]
97
97
  -- - [2, 3]
98
98
  -- - [1, 2, 3]
99
- function ____exports.getSetCombinations(self, set)
99
+ --
100
+ -- @param set The set to get the combinations of.
101
+ -- @param includeEmptyArray Whether or not to include an empty array in the combinations.
102
+ function ____exports.getSetCombinations(self, set, includeEmptyArray)
100
103
  local values = ____exports.getSortedSetValues(nil, set)
101
- local combinations = getArrayCombinations(nil, values)
104
+ local combinations = getArrayCombinations(nil, values, includeEmptyArray)
102
105
  return __TS__ArrayMap(
103
106
  combinations,
104
107
  function(____, array) return __TS__New(Set, array) end
@@ -6,8 +6,8 @@ ____exports.OPPOSITE_DOOR_SLOTS = {
6
6
  [DoorSlot.LEFT_0] = DoorSlot.RIGHT_0,
7
7
  [DoorSlot.UP_0] = DoorSlot.DOWN_0,
8
8
  [DoorSlot.RIGHT_0] = DoorSlot.LEFT_0,
9
- [DoorSlot.LEFT_1] = DoorSlot.RIGHT_1,
10
9
  [DoorSlot.DOWN_0] = DoorSlot.UP_0,
10
+ [DoorSlot.LEFT_1] = DoorSlot.RIGHT_1,
11
11
  [DoorSlot.UP_1] = DoorSlot.DOWN_1,
12
12
  [DoorSlot.RIGHT_1] = DoorSlot.LEFT_1,
13
13
  [DoorSlot.DOWN_1] = DoorSlot.UP_1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "4.9.0",
3
+ "version": "4.9.1",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",