isaacscript-common 84.1.2 → 84.2.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.
Files changed (37) hide show
  1. package/dist/classes/features/callbackLogic/PlayerCollectibleDetection.d.ts.map +1 -1
  2. package/dist/classes/features/callbackLogic/PlayerCollectibleDetection.js +3 -2
  3. package/dist/classes/features/callbackLogic/PlayerCollectibleDetection.lua +4 -2
  4. package/dist/functions/array.d.ts +1 -1
  5. package/dist/functions/array.d.ts.map +1 -1
  6. package/dist/functions/array.js +2 -1
  7. package/dist/functions/array.lua +3 -1
  8. package/dist/functions/enums.d.ts.map +1 -1
  9. package/dist/functions/enums.js +7 -4
  10. package/dist/functions/enums.lua +9 -4
  11. package/dist/functions/logMisc.d.ts +2 -2
  12. package/dist/functions/logMisc.d.ts.map +1 -1
  13. package/dist/functions/logMisc.js +3 -4
  14. package/dist/functions/logMisc.lua +4 -3
  15. package/dist/functions/set.d.ts +3 -3
  16. package/dist/functions/set.d.ts.map +1 -1
  17. package/dist/functions/set.js +2 -1
  18. package/dist/functions/set.lua +3 -1
  19. package/dist/functions/sort.d.ts +2 -1
  20. package/dist/functions/sort.d.ts.map +1 -1
  21. package/dist/functions/sort.js +3 -2
  22. package/dist/functions/sort.lua +6 -6
  23. package/dist/functions/table.js +1 -1
  24. package/dist/functions/types.d.ts.map +1 -1
  25. package/dist/functions/types.js +7 -5
  26. package/dist/functions/types.lua +3 -1
  27. package/dist/index.rollup.d.ts +9 -7
  28. package/dist/isaacscript-common.lua +33 -19
  29. package/package.json +1 -1
  30. package/src/classes/features/callbackLogic/PlayerCollectibleDetection.ts +3 -2
  31. package/src/functions/array.ts +3 -2
  32. package/src/functions/enums.ts +7 -6
  33. package/src/functions/logMisc.ts +5 -6
  34. package/src/functions/set.ts +7 -4
  35. package/src/functions/sort.ts +2 -2
  36. package/src/functions/table.ts +1 -1
  37. package/src/functions/types.ts +7 -5
@@ -1 +1 @@
1
- {"version":3,"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,CAAC,cAAc,CAe7B;IAGF,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAiBzC;IAEF;;;;;;;;OAQG;IACH,OAAO,CAAC,uBAAuB;CA+BhC"}
@@ -9,6 +9,7 @@ const array_1 = require("../../../functions/array");
9
9
  const flag_1 = require("../../../functions/flag");
10
10
  const playerDataStructures_1 = require("../../../functions/playerDataStructures");
11
11
  const players_1 = require("../../../functions/players");
12
+ const sort_1 = require("../../../functions/sort");
12
13
  const utils_1 = require("../../../functions/utils");
13
14
  const DefaultMap_1 = require("../../DefaultMap");
14
15
  const Feature_1 = require("../../private/Feature");
@@ -181,8 +182,8 @@ class PlayerCollectibleDetection extends Feature_1.Feature {
181
182
  // For example, it is possible for the player to switch Schoolbag items, which will cause the
182
183
  // collectibles in the array to be the same, but in a different order. Thus, we sort both arrays
183
184
  // before comparing them.
184
- oldCollectibleTypes.sort();
185
- newCollectibleTypes.sort();
185
+ oldCollectibleTypes.sort(sort_1.sortNormal);
186
+ newCollectibleTypes.sort(sort_1.sortNormal);
186
187
  if (!(0, array_1.arrayEquals)(oldCollectibleTypes, newCollectibleTypes)) {
187
188
  // One or more active items have changed (with the player's total collectible count remaining
188
189
  // the same).
@@ -32,6 +32,8 @@ local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
32
32
  local mapSetPlayer = ____playerDataStructures.mapSetPlayer
33
33
  local ____players = require("functions.players")
34
34
  local getPlayerFromPtr = ____players.getPlayerFromPtr
35
+ local ____sort = require("functions.sort")
36
+ local sortNormal = ____sort.sortNormal
35
37
  local ____utils = require("functions.utils")
36
38
  local ____repeat = ____utils["repeat"]
37
39
  local ____DefaultMap = require("classes.DefaultMap")
@@ -155,8 +157,8 @@ function PlayerCollectibleDetection.prototype.checkActiveItemsChanged(self, play
155
157
  oldCollectibleTypes[#oldCollectibleTypes + 1] = oldCollectibleType
156
158
  newCollectibleTypes[#newCollectibleTypes + 1] = newCollectibleType
157
159
  end
158
- __TS__ArraySort(oldCollectibleTypes)
159
- __TS__ArraySort(newCollectibleTypes)
160
+ __TS__ArraySort(oldCollectibleTypes, sortNormal)
161
+ __TS__ArraySort(newCollectibleTypes, sortNormal)
160
162
  if not arrayEquals(nil, oldCollectibleTypes, newCollectibleTypes) then
161
163
  self:updateCollectibleMapAndFire(player, nil)
162
164
  end
@@ -134,7 +134,7 @@ export declare function getArrayCombinations<T>(array: readonly T[], includeEmpt
134
134
  * Helper function to get the duplicate elements in an array. Only one element for each value will
135
135
  * be returned. The elements will be sorted before they are returned.
136
136
  */
137
- export declare function getArrayDuplicateElements<T>(array: readonly T[]): readonly T[];
137
+ export declare function getArrayDuplicateElements<T extends number | string>(array: readonly T[]): readonly T[];
138
138
  /**
139
139
  * Helper function to get an array containing the indexes of an array.
140
140
  *
@@ -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;AAM1D;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,MAAM,EAAE,SAAS,CAAC,EAAE,EACpB,MAAM,EAAE,SAAS,CAAC,EAAE,GACnB,OAAO,CAST;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,aAAa,EAAE,SAAS,CAAC,EAAE,EAC3B,GAAG,gBAAgB,EAAE,SAAS,CAAC,EAAE,GAChC,CAAC,EAAE,CAWL;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,aAAa,EAAE,SAAS,CAAC,EAAE,EAC3B,GAAG,gBAAgB,EAAE,SAAS,CAAC,EAAE,GAChC,CAAC,EAAE,CAIL;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAErC,KAAK,EAAE,CAAC,EAAE,EACV,GAAG,gBAAgB,EAAE,SAAS,CAAC,EAAE,GAChC,OAAO,CAcT;AAED;;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EAC9B,YAAY,EAAE,SAAS,CAAC,EAAE,EAC1B,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC,GACvC,OAAO,CAET;AAED,4EAA4E;AAE5E,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAIjE;AAED;;;;;;;;;;;;GAYG;AAEH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,aAAa,EAAE,SAAS,CAAC,EAAE,EAC3B,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,GAChC,CAAC,EAAE,CAKL;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAEnC,KAAK,EAAE,CAAC,EAAE,EACV,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;AAEH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAM3E"}
@@ -4,6 +4,7 @@ exports.swapArrayElements = exports.sumArray = exports.shuffleArrayInPlace = exp
4
4
  const ReadonlySet_1 = require("../types/ReadonlySet");
5
5
  const random_1 = require("./random");
6
6
  const rng_1 = require("./rng");
7
+ const sort_1 = require("./sort");
7
8
  const types_1 = require("./types");
8
9
  const utils_1 = require("./utils");
9
10
  /**
@@ -314,7 +315,7 @@ function getArrayDuplicateElements(array) {
314
315
  set.add(element);
315
316
  }
316
317
  const values = [...duplicateElements];
317
- return values.sort();
318
+ return values.sort(sort_1.sortNormal);
318
319
  }
319
320
  exports.getArrayDuplicateElements = getArrayDuplicateElements;
320
321
  /**
@@ -29,6 +29,8 @@ local getRandomInt = ____random.getRandomInt
29
29
  local ____rng = require("functions.rng")
30
30
  local isRNG = ____rng.isRNG
31
31
  local newRNG = ____rng.newRNG
32
+ local ____sort = require("functions.sort")
33
+ local sortNormal = ____sort.sortNormal
32
34
  local ____types = require("functions.types")
33
35
  local isNumber = ____types.isNumber
34
36
  local isTable = ____types.isTable
@@ -387,7 +389,7 @@ function ____exports.getArrayDuplicateElements(self, array)
387
389
  set:add(element)
388
390
  end
389
391
  local values = {__TS__Spread(duplicateElements)}
390
- return __TS__ArraySort(values)
392
+ return __TS__ArraySort(values, sortNormal)
391
393
  end
392
394
  --- Helper function to get an array containing the indexes of an array.
393
395
  --
@@ -1 +1 @@
1
- {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../src/functions/enums.ts"],"names":[],"mappings":";;;;;AAKA;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CACjC,MAAM,EACN,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CACvC,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,cAAc,EACrD,cAAc,EAAE,CAAC,GAChB,aAAa,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAmBjD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,cAAc,EAAE,cAAc,GAAG,SAAS,MAAM,EAAE,CAG7E;AAED,sEAAsE;AACtE,wBAAgB,aAAa,CAAC,cAAc,EAAE,cAAc,GAAG,GAAG,CAGjE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAC1B,cAAc,EAAE,cAAc,GAC7B,SAAS,MAAM,EAAE,CAanB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,cAAc,EACpD,cAAc,EAAE,CAAC,GAChB,aAAa,CAAC,CAAC,CAAC,MAAM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,MAAM,CAAC,CAAC,CAAM,GACzC,CAAC,CAAC,MAAM,CAAC,CAAC,CAGZ;AAED,oFAAoF;AACpF,wBAAgB,WAAW,CAAC,CAAC,SAAS,cAAc,EAClD,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,EAC7C,cAAc,EAAE,CAAC,GAChB,KAAK,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAGrB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAChC,kBAAkB,EAAE,MAAM,EAC1B,cAAc,EAAE,cAAc,GAC7B,IAAI,CAQN;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,cAAc,EAC7D,kBAAkB,EAAE,MAAM,EAC1B,cAAc,EAAE,CAAC,GAChB,IAAI,CAsBN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,4BAA4B,CAE1C,CAAC,SAAS,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,EAC/B,IAAI,SAAS,MAAM,GAAG,MAAM,KACzB,IAAI,CAAG"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateInterfaceMatchesEnum = exports.validateEnumContiguous = exports.validateCustomEnum = exports.isEnumValue = exports.getRandomEnumValue = exports.getLowestEnumValue = exports.getHighestEnumValue = exports.getEnumValues = exports.getEnumNames = exports.getEnumLength = exports.getEnumKeys = exports.getEnumEntries = void 0;
4
4
  const ReadonlySet_1 = require("../types/ReadonlySet");
5
5
  const array_1 = require("./array");
6
+ const sort_1 = require("./sort");
6
7
  const types_1 = require("./types");
7
8
  const utils_1 = require("./utils");
8
9
  /**
@@ -128,8 +129,9 @@ exports.getEnumValues = getEnumValues;
128
129
  */
129
130
  function getHighestEnumValue(transpiledEnum) {
130
131
  const enumValues = getEnumValues(transpiledEnum);
131
- const lastElement = enumValues.at(-1);
132
- (0, utils_1.assertDefined)(lastElement, "Failed to get the last value from an enum since the enum was empty.");
132
+ const sortedValues = enumValues.toSorted(sort_1.sortNormal);
133
+ const lastElement = sortedValues.at(-1);
134
+ (0, utils_1.assertDefined)(lastElement, "Failed to get the highest value from an enum since the enum was empty.");
133
135
  return lastElement;
134
136
  }
135
137
  exports.getHighestEnumValue = getHighestEnumValue;
@@ -143,8 +145,9 @@ exports.getHighestEnumValue = getHighestEnumValue;
143
145
  */
144
146
  function getLowestEnumValue(transpiledEnum) {
145
147
  const enumValues = getEnumValues(transpiledEnum);
146
- const firstElement = enumValues[0];
147
- (0, utils_1.assertDefined)(firstElement, "Failed to get the first value from an enum since the enum was empty.");
148
+ const sortedValues = enumValues.toSorted(sort_1.sortNormal);
149
+ const firstElement = sortedValues[0];
150
+ (0, utils_1.assertDefined)(firstElement, "Failed to get the lowest value from an enum since the enum was empty.");
148
151
  return firstElement;
149
152
  }
150
153
  exports.getLowestEnumValue = getLowestEnumValue;
@@ -1,6 +1,7 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__ArraySort = ____lualib.__TS__ArraySort
3
3
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
4
+ local __TS__ArrayToSorted = ____lualib.__TS__ArrayToSorted
4
5
  local __TS__ArrayAt = ____lualib.__TS__ArrayAt
5
6
  local __TS__ArrayIncludes = ____lualib.__TS__ArrayIncludes
6
7
  local __TS__New = ____lualib.__TS__New
@@ -9,6 +10,8 @@ local ____ReadonlySet = require("types.ReadonlySet")
9
10
  local ReadonlySet = ____ReadonlySet.ReadonlySet
10
11
  local ____array = require("functions.array")
11
12
  local getRandomArrayElement = ____array.getRandomArrayElement
13
+ local ____sort = require("functions.sort")
14
+ local sortNormal = ____sort.sortNormal
12
15
  local ____types = require("functions.types")
13
16
  local isNumber = ____types.isNumber
14
17
  local isString = ____types.isString
@@ -144,8 +147,9 @@ end
144
147
  -- Throws an error if the provided enum is empty.
145
148
  function ____exports.getHighestEnumValue(self, transpiledEnum)
146
149
  local enumValues = ____exports.getEnumValues(nil, transpiledEnum)
147
- local lastElement = __TS__ArrayAt(enumValues, -1)
148
- assertDefined(nil, lastElement, "Failed to get the last value from an enum since the enum was empty.")
150
+ local sortedValues = __TS__ArrayToSorted(enumValues, sortNormal)
151
+ local lastElement = __TS__ArrayAt(sortedValues, -1)
152
+ assertDefined(nil, lastElement, "Failed to get the highest value from an enum since the enum was empty.")
149
153
  return lastElement
150
154
  end
151
155
  --- Helper function to get the enum value with the lowest value.
@@ -156,8 +160,9 @@ end
156
160
  -- Throws an error if the provided enum is empty.
157
161
  function ____exports.getLowestEnumValue(self, transpiledEnum)
158
162
  local enumValues = ____exports.getEnumValues(nil, transpiledEnum)
159
- local firstElement = enumValues[1]
160
- assertDefined(nil, firstElement, "Failed to get the first value from an enum since the enum was empty.")
163
+ local sortedValues = __TS__ArrayToSorted(enumValues, sortNormal)
164
+ local firstElement = sortedValues[1]
165
+ assertDefined(nil, firstElement, "Failed to get the lowest value from an enum since the enum was empty.")
161
166
  return firstElement
162
167
  end
163
168
  --- Helper function to get a random value from the provided enum.
@@ -56,7 +56,7 @@ export declare function logLevelStateFlags(this: void): void;
56
56
  * @param map The TSTL `Map` to log.
57
57
  * @param name Optional. The name of the map, which will be logged before the elements.
58
58
  */
59
- export declare function logMap(this: void, map: ReadonlyMap<AnyNotNil, unknown>, name?: string): void;
59
+ export declare function logMap(this: void, map: ReadonlyMap<number | string, unknown>, name?: string): void;
60
60
  export declare function logMusic(this: void): void;
61
61
  export declare function logPlayerEffects(this: void, player: EntityPlayer): void;
62
62
  export declare function logPlayerHealth(this: void, player: EntityPlayer): void;
@@ -75,7 +75,7 @@ export declare function logSeedEffects(this: void): void;
75
75
  * @param set The TSTL `Set` to log.
76
76
  * @param name Optional. The name of the set, which will be logged before the elements.
77
77
  */
78
- export declare function logSet(this: void, set: ReadonlySet<AnyNotNil>, name?: string): void;
78
+ export declare function logSet(this: void, set: ReadonlySet<number | string>, name?: string): void;
79
79
  /** Helper function for logging every sound effect that is currently playing. */
80
80
  export declare function logSounds(this: void): void;
81
81
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"logMisc.d.ts","sourceRoot":"","sources":["../../src/functions/logMisc.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACb,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,UAAU,EACV,WAAW,EACX,UAAU,EAMV,cAAc,EAKd,QAAQ,EACR,OAAO,EACR,MAAM,8BAA8B,CAAC;AAGtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAsB9D;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EACxB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,IAAI,CAAC,EAAE,MAAM,GACZ,IAAI,CAaN;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,EACV,gBAAgB,EAAE,SAAS,eAAe,EAAE,EAC5C,IAAI,CAAC,EAAE,MAAM,GACZ,IAAI,CAaN;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAQtE;AAED,yFAAyF;AACzF,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,GAC7C,IAAI,CAEN;AAED,0FAA0F;AAC1F,wBAAgB,eAAe,CAC7B,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC,GAChD,IAAI,CAEN;AAED,yFAAyF;AACzF,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,GAC7C,IAAI,CAEN;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,I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ACpD,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACrB,IAAI,CAqBN;AAED,wFAAwF;AACxF,wBAAgB,YAAY,CAC1B,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,GACvC,IAAI,CAEN;AAED,gGAAgG;AAChG,wBAAgB,WAAW,CACzB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,GACpC,IAAI,CAEN;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAoB/D;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,MAAM,EACb,KAAK,UAAQ,GACZ,IAAI,CAON"}
@@ -18,6 +18,7 @@ const playerHealth_1 = require("./playerHealth");
18
18
  const players_1 = require("./players");
19
19
  const roomData_1 = require("./roomData");
20
20
  const set_1 = require("./set");
21
+ const sort_1 = require("./sort");
21
22
  const table_1 = require("./table");
22
23
  const trinkets_1 = require("./trinkets");
23
24
  const tstlClass_1 = require("./tstlClass");
@@ -197,10 +198,9 @@ function logMap(map, name) {
197
198
  const suffix = name === undefined ? "" : ` "${name}"`;
198
199
  (0, log_1.log)(`Logging a TSTL map${suffix}:`);
199
200
  const mapKeys = [...map.keys()];
200
- mapKeys.sort();
201
+ mapKeys.sort(sort_1.sortNormal);
201
202
  for (const key of mapKeys) {
202
203
  const value = map.get(key);
203
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
204
204
  (0, log_1.log)(` ${key} --> ${value}`);
205
205
  }
206
206
  (0, log_1.log)(` The size of the map was: ${map.size}`);
@@ -327,7 +327,6 @@ function logSet(set, name) {
327
327
  (0, log_1.log)(`Logging a TSTL set${suffix}:`);
328
328
  const setValues = (0, set_1.getSortedSetValues)(set);
329
329
  for (const value of setValues) {
330
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
331
330
  (0, log_1.log)(` Value: ${value}`);
332
331
  }
333
332
  (0, log_1.log)(` The size of the set was: ${set.size}`);
@@ -395,7 +394,7 @@ function logTableDifferences(table1, table2) {
395
394
  const table2KeysSet = new ReadonlySet_1.ReadonlySet(table2Keys);
396
395
  const keysSet = (0, set_1.combineSets)(table1KeysSet, table2KeysSet);
397
396
  const keys = [...keysSet.values()];
398
- keys.sort();
397
+ keys.sort(); // eslint-disable-line @typescript-eslint/require-array-sort-compare
399
398
  for (const key of keys) {
400
399
  const value1 = table1.get(key);
401
400
  const value2 = table2.get(key);
@@ -1,13 +1,12 @@
1
1
  local ____lualib = require("lualib_bundle")
2
- local Map = ____lualib.Map
3
2
  local __TS__Spread = ____lualib.__TS__Spread
4
3
  local __TS__ArraySort = ____lualib.__TS__ArraySort
5
4
  local __TS__ArrayEntries = ____lualib.__TS__ArrayEntries
6
5
  local __TS__Iterator = ____lualib.__TS__Iterator
7
- local Set = ____lualib.Set
8
6
  local __TS__TypeOf = ____lualib.__TS__TypeOf
9
7
  local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
10
8
  local __TS__New = ____lualib.__TS__New
9
+ local Set = ____lualib.Set
11
10
  local ____exports = {}
12
11
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
13
12
  local BossID = ____isaac_2Dtypescript_2Ddefinitions.BossID
@@ -64,6 +63,8 @@ local getRoomListIndex = ____roomData.getRoomListIndex
64
63
  local ____set = require("functions.set")
65
64
  local combineSets = ____set.combineSets
66
65
  local getSortedSetValues = ____set.getSortedSetValues
66
+ local ____sort = require("functions.sort")
67
+ local sortNormal = ____sort.sortNormal
67
68
  local ____table = require("functions.table")
68
69
  local iterateTableInOrder = ____table.iterateTableInOrder
69
70
  local ____trinkets = require("functions.trinkets")
@@ -232,7 +233,7 @@ function ____exports.logMap(map, name)
232
233
  local suffix = name == nil and "" or (" \"" .. name) .. "\""
233
234
  log(("Logging a TSTL map" .. suffix) .. ":")
234
235
  local mapKeys = {__TS__Spread(map:keys())}
235
- __TS__ArraySort(mapKeys)
236
+ __TS__ArraySort(mapKeys, sortNormal)
236
237
  for ____, key in ipairs(mapKeys) do
237
238
  local value = map:get(key)
238
239
  log(((" " .. tostring(key)) .. " --> ") .. tostring(value))
@@ -34,7 +34,7 @@ export declare function deleteSetsFromSet<T>(mainSet: Set<T>, ...setsToRemove: R
34
34
  * a random seed.
35
35
  * @param exceptions Optional. An array of elements to skip over if selected.
36
36
  */
37
- export declare function getRandomSetElement<T>(set: ReadonlySet<T>, seedOrRNG: Seed | RNG | undefined, exceptions?: readonly T[]): T;
37
+ export declare function getRandomSetElement<T extends number | string>(set: ReadonlySet<T>, seedOrRNG: Seed | RNG | undefined, exceptions?: readonly T[]): T;
38
38
  /**
39
39
  * Helper function to get all possible combinations of the given set. This includes the combination
40
40
  * of an empty set.
@@ -54,14 +54,14 @@ export declare function getRandomSetElement<T>(set: ReadonlySet<T>, seedOrRNG: S
54
54
  * @param set The set to get the combinations of.
55
55
  * @param includeEmptyArray Whether to include an empty array in the combinations.
56
56
  */
57
- export declare function getSetCombinations<T>(set: ReadonlySet<T>, includeEmptyArray: boolean): ReadonlyArray<ReadonlySet<T>>;
57
+ export declare function getSetCombinations<T extends number | string>(set: ReadonlySet<T>, includeEmptyArray: boolean): ReadonlyArray<ReadonlySet<T>>;
58
58
  /**
59
59
  * Helper function to get a sorted array based on the contents of a set.
60
60
  *
61
61
  * Normally, set values are returned in insertion order, so use this function when the ordering of
62
62
  * the contents is important.
63
63
  */
64
- export declare function getSortedSetValues<T>(set: ReadonlySet<T>): T[];
64
+ export declare function getSortedSetValues<T extends number | string>(set: ReadonlySet<T>): T[];
65
65
  /**
66
66
  * Helper function to convert the keys of an object to a read-only set.
67
67
  *
@@ -1 +1 @@
1
- {"version":3,"file":"set.d.ts","sourceRoot":"","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AAM,GAAG,MAAM,EAAE,CAAC,EAC3E,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,WAAW,CAAC,CAAC,CAAC,CAEhB;AAED;;;;;;;GAOG;AAEH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,EACnE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,GAAG,CAAC,CAAC,CAAC,CAQR;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAClC,CAAC,EACD,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAEtC;AAED;;;;;;;GAOG;AAEH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,EACrE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,GAAG,CAAC,CAAC,CAAC,CAQR;AAED;;;;;GAKG;AAEH,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"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sumSet = exports.setHas = exports.setAdd = exports.objectValuesToSet = exports.objectValuesToReadonlySet = exports.objectKeysToSet = exports.objectKeysToReadonlySet = exports.getSortedSetValues = exports.getSetCombinations = exports.getRandomSetElement = exports.deleteSetsFromSet = exports.copySet = exports.combineSets = exports.addSetsToSet = void 0;
4
4
  const ReadonlySet_1 = require("../types/ReadonlySet");
5
5
  const array_1 = require("./array");
6
+ const sort_1 = require("./sort");
6
7
  const types_1 = require("./types");
7
8
  /**
8
9
  * Helper function to add all of the values in one set to another set. The first set passed will be
@@ -121,7 +122,7 @@ function getSortedSetValues(set) {
121
122
  error(`Failed to get the sorted set values because the provided set was of type "${arrayType}". Having sets with non-primitive types doesn't make much sense in general, so you might need to rethink what you are doing.`);
122
123
  }
123
124
  }
124
- values.sort();
125
+ values.sort(sort_1.sortNormal);
125
126
  return values;
126
127
  }
127
128
  exports.getSortedSetValues = getSortedSetValues;
@@ -15,6 +15,8 @@ local ____array = require("functions.array")
15
15
  local getArrayCombinations = ____array.getArrayCombinations
16
16
  local getRandomArrayElement = ____array.getRandomArrayElement
17
17
  local sumArray = ____array.sumArray
18
+ local ____sort = require("functions.sort")
19
+ local sortNormal = ____sort.sortNormal
18
20
  local ____types = require("functions.types")
19
21
  local isPrimitive = ____types.isPrimitive
20
22
  --- Helper function to get a sorted array based on the contents of a set.
@@ -30,7 +32,7 @@ function ____exports.getSortedSetValues(self, set)
30
32
  error(("Failed to get the sorted set values because the provided set was of type \"" .. tostring(arrayType)) .. "\". Having sets with non-primitive types doesn't make much sense in general, so you might need to rethink what you are doing.")
31
33
  end
32
34
  end
33
- __TS__ArraySort(values)
35
+ __TS__ArraySort(values, sortNormal)
34
36
  return values
35
37
  end
36
38
  --- Helper function to convert the keys of an object to a set.
@@ -1,3 +1,4 @@
1
+ export declare function sortNormal(a: unknown, b: unknown): -1 | 0 | 1;
1
2
  /**
2
3
  * Helper function to sort an array of objects by one of the object keys.
3
4
  *
@@ -25,7 +26,7 @@ export declare function sortObjectArrayByKey(key: string): (a: unknown, b: unkno
25
26
  *
26
27
  * ```ts
27
28
  * const myArray = [[1, 2], [2, 3], [3, 4]];
28
- * myArray.sort(twoDimensionalSort);
29
+ * myArray.sort(sortTwoDimensionalArray);
29
30
  * ```
30
31
  *
31
32
  * This function also properly handles when the array elements are strings or numbers (instead of
@@ -1 +1 @@
1
- {"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../src/functions/sort.ts"],"names":[],"mappings":"AA8BA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,OACnC,OAAO,KAAK,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;AAEH,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,GAChD,CAAC,EAAE,CAuDL"}
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,OACnC,OAAO,KAAK,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;AAEH,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,GAChD,CAAC,EAAE,CAuDL"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stableSort = exports.sortTwoDimensionalArray = exports.sortObjectArrayByKey = void 0;
3
+ exports.stableSort = exports.sortTwoDimensionalArray = exports.sortObjectArrayByKey = exports.sortNormal = void 0;
4
4
  const types_1 = require("./types");
5
5
  function sortNormal(a, b) {
6
6
  if (!(0, types_1.isNumber)(a) && !(0, types_1.isString)(a)) {
@@ -17,6 +17,7 @@ function sortNormal(a, b) {
17
17
  }
18
18
  return 0;
19
19
  }
20
+ exports.sortNormal = sortNormal;
20
21
  /**
21
22
  * Helper function to sort an array of objects by one of the object keys.
22
23
  *
@@ -57,7 +58,7 @@ exports.sortObjectArrayByKey = sortObjectArrayByKey;
57
58
  *
58
59
  * ```ts
59
60
  * const myArray = [[1, 2], [2, 3], [3, 4]];
60
- * myArray.sort(twoDimensionalSort);
61
+ * myArray.sort(sortTwoDimensionalArray);
61
62
  * ```
62
63
  *
63
64
  * This function also properly handles when the array elements are strings or numbers (instead of
@@ -5,7 +5,7 @@ local ____types = require("functions.types")
5
5
  local isNumber = ____types.isNumber
6
6
  local isString = ____types.isString
7
7
  local isTable = ____types.isTable
8
- local function sortNormal(self, a, b)
8
+ function ____exports.sortNormal(self, a, b)
9
9
  if not isNumber(nil, a) and not isString(nil, a) then
10
10
  error("Failed to normal sort since the first value was not a number or string and was instead: " .. type(a))
11
11
  end
@@ -47,7 +47,7 @@ function ____exports.sortObjectArrayByKey(self, key)
47
47
  end
48
48
  local aValue = a[key]
49
49
  local bValue = b[key]
50
- return sortNormal(nil, aValue, bValue)
50
+ return ____exports.sortNormal(nil, aValue, bValue)
51
51
  end
52
52
  end
53
53
  --- Helper function to sort a two-dimensional array by the first element.
@@ -56,7 +56,7 @@ end
56
56
  --
57
57
  -- ```ts
58
58
  -- const myArray = [[1, 2], [2, 3], [3, 4]];
59
- -- myArray.sort(twoDimensionalSort);
59
+ -- myArray.sort(sortTwoDimensionalArray);
60
60
  -- ```
61
61
  --
62
62
  -- This function also properly handles when the array elements are strings or numbers (instead of
@@ -71,7 +71,7 @@ function ____exports.sortTwoDimensionalArray(self, a, b)
71
71
  error(((((((("Failed to two-dimensional sort since the two elements were disparate types: " .. tostring(a)) .. " & ") .. tostring(b)) .. " (") .. aType) .. " & ") .. bType) .. ")")
72
72
  end
73
73
  if aType == "string" or aType == "number" then
74
- return sortNormal(nil, a, b)
74
+ return ____exports.sortNormal(nil, a, b)
75
75
  end
76
76
  if aType ~= "table" then
77
77
  error("Failed to two-dimensional sort since the first element was not a string, number, or table.")
@@ -92,7 +92,7 @@ function ____exports.sortTwoDimensionalArray(self, a, b)
92
92
  if elementType1 ~= elementType2 then
93
93
  error(((((((("Failed to two-dimensional sort since the first element of each array were disparate types: " .. tostring(firstElement1)) .. " & ") .. tostring(firstElement2)) .. " (") .. elementType1) .. " & ") .. elementType2) .. ")")
94
94
  end
95
- return sortNormal(nil, firstElement1, firstElement2)
95
+ return ____exports.sortNormal(nil, firstElement1, firstElement2)
96
96
  end
97
97
  --- Helper function to sort an array in a stable way.
98
98
  --
@@ -101,7 +101,7 @@ end
101
101
  -- Under the hood, this uses the merge sort algorithm.
102
102
  function ____exports.stableSort(self, array, sortFunc)
103
103
  if sortFunc == nil then
104
- sortFunc = sortNormal
104
+ sortFunc = ____exports.sortNormal
105
105
  end
106
106
  if #array <= 1 then
107
107
  return array
@@ -140,7 +140,7 @@ function iterateTableInOrder(luaMap, func, inOrder = true) {
140
140
  }
141
141
  return;
142
142
  }
143
- keys.sort();
143
+ keys.sort(); // eslint-disable-line @typescript-eslint/require-array-sort-compare
144
144
  for (const key of keys) {
145
145
  const keyIndex = key;
146
146
  const value = luaMap.get(keyIndex);
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/functions/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;AAEH,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EACf,UAAU,EACV,QAAQ,EACR,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAEtC;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,QAAQ,CAE7C;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,eAAe,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAE1C;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAEtC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,CAEjD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,QAAQ,CAE7C;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,CAEjD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,CAEjD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,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IAAI,GAAG,CAM5D;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,MAAM,CAE9D;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,CACzB,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,OAAO,GAAG,MAAM,GAAG,MAAM,CAOvC;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,MAAM,CAE9D;AAED,wBAAgB,OAAO,CACrB,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAGxC;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,WAAW,CAGrE;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAe5D"}
@@ -161,12 +161,12 @@ function asTrinketType(num) {
161
161
  }
162
162
  exports.asTrinketType = asTrinketType;
163
163
  function isBoolean(variable) {
164
- return type(variable) === "boolean";
164
+ return typeof variable === "boolean";
165
165
  }
166
166
  exports.isBoolean = isBoolean;
167
167
  // eslint-disable-next-line @typescript-eslint/ban-types
168
168
  function isFunction(variable) {
169
- return type(variable) === "function";
169
+ return typeof variable === "function";
170
170
  }
171
171
  exports.isFunction = isFunction;
172
172
  function isInteger(variable) {
@@ -177,26 +177,28 @@ function isInteger(variable) {
177
177
  }
178
178
  exports.isInteger = isInteger;
179
179
  function isNumber(variable) {
180
- return type(variable) === "number";
180
+ return typeof variable === "number";
181
181
  }
182
182
  exports.isNumber = isNumber;
183
183
  /** Helper function to detect if a variable is a boolean, number, or string. */
184
184
  function isPrimitive(variable) {
185
- const variableType = type(variable);
185
+ const variableType = typeof variable;
186
186
  return (variableType === "boolean" ||
187
187
  variableType === "number" ||
188
188
  variableType === "string");
189
189
  }
190
190
  exports.isPrimitive = isPrimitive;
191
191
  function isString(variable) {
192
- return type(variable) === "string";
192
+ return typeof variable === "string";
193
193
  }
194
194
  exports.isString = isString;
195
195
  function isTable(variable) {
196
+ // We cannot use `typeof` here since "table" is not a JavaScript type.
196
197
  return type(variable) === "table";
197
198
  }
198
199
  exports.isTable = isTable;
199
200
  function isUserdata(variable) {
201
+ // We cannot use `typeof` here since "userdata" is not a JavaScript type.
200
202
  return type(variable) === "userdata";
201
203
  }
202
204
  exports.isUserdata = isUserdata;
@@ -1,3 +1,5 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__TypeOf = ____lualib.__TS__TypeOf
1
3
  local ____exports = {}
2
4
  function ____exports.isNumber(self, variable)
3
5
  return type(variable) == "number"
@@ -107,7 +109,7 @@ function ____exports.isInteger(self, variable)
107
109
  end
108
110
  --- Helper function to detect if a variable is a boolean, number, or string.
109
111
  function ____exports.isPrimitive(self, variable)
110
- local variableType = type(variable)
112
+ local variableType = __TS__TypeOf(variable)
111
113
  return variableType == "boolean" or variableType == "number" or variableType == "string"
112
114
  end
113
115
  function ____exports.isString(self, variable)
@@ -5047,7 +5047,7 @@ export declare function getArrayCombinations<T>(array: readonly T[], includeEmpt
5047
5047
  * Helper function to get the duplicate elements in an array. Only one element for each value will
5048
5048
  * be returned. The elements will be sorted before they are returned.
5049
5049
  */
5050
- export declare function getArrayDuplicateElements<T>(array: readonly T[]): readonly T[];
5050
+ export declare function getArrayDuplicateElements<T extends number | string>(array: readonly T[]): readonly T[];
5051
5051
 
5052
5052
  /**
5053
5053
  * Helper function to get an array containing the indexes of an array.
@@ -7261,7 +7261,7 @@ export declare function getRandomSeed(): Seed;
7261
7261
  * a random seed.
7262
7262
  * @param exceptions Optional. An array of elements to skip over if selected.
7263
7263
  */
7264
- export declare function getRandomSetElement<T>(set: ReadonlySet<T>, seedOrRNG: Seed | RNG | undefined, exceptions?: readonly T[]): T;
7264
+ export declare function getRandomSetElement<T extends number | string>(set: ReadonlySet<T>, seedOrRNG: Seed | RNG | undefined, exceptions?: readonly T[]): T;
7265
7265
 
7266
7266
  /**
7267
7267
  * Helper function to get a random vector between (-1, -1) and (1, 1).
@@ -7876,7 +7876,7 @@ export declare function getSeedEffects(): readonly SeedEffect[];
7876
7876
  * @param set The set to get the combinations of.
7877
7877
  * @param includeEmptyArray Whether to include an empty array in the combinations.
7878
7878
  */
7879
- export declare function getSetCombinations<T>(set: ReadonlySet<T>, includeEmptyArray: boolean): ReadonlyArray<ReadonlySet<T>>;
7879
+ export declare function getSetCombinations<T extends number | string>(set: ReadonlySet<T>, includeEmptyArray: boolean): ReadonlyArray<ReadonlySet<T>>;
7880
7880
 
7881
7881
  /**
7882
7882
  * Helper function to get the shooting actions that the specified `ControllerIndex` is currently
@@ -7934,7 +7934,7 @@ export declare function getSlots(slotVariant?: SlotVariant | -1, subType?: numbe
7934
7934
  * Normally, set values are returned in insertion order, so use this function when the ordering of
7935
7935
  * the contents is important.
7936
7936
  */
7937
- export declare function getSortedSetValues<T>(set: ReadonlySet<T>): T[];
7937
+ export declare function getSortedSetValues<T extends number | string>(set: ReadonlySet<T>): T[];
7938
7938
 
7939
7939
  /** Helper function to get all of the `GridEntitySpikes` in the room. */
7940
7940
  export declare function getSpikes(variant?: number): readonly GridEntitySpikes[];
@@ -10860,7 +10860,7 @@ export declare function logLevelStateFlags(this: void): void;
10860
10860
  * @param map The TSTL `Map` to log.
10861
10861
  * @param name Optional. The name of the map, which will be logged before the elements.
10862
10862
  */
10863
- export declare function logMap(this: void, map: ReadonlyMap<AnyNotNil, unknown>, name?: string): void;
10863
+ export declare function logMap(this: void, map: ReadonlyMap<number | string, unknown>, name?: string): void;
10864
10864
 
10865
10865
  export declare function logMusic(this: void): void;
10866
10866
 
@@ -10901,7 +10901,7 @@ export declare function logSeedEffects(this: void): void;
10901
10901
  * @param set The TSTL `Set` to log.
10902
10902
  * @param name Optional. The name of the set, which will be logged before the elements.
10903
10903
  */
10904
- export declare function logSet(this: void, set: ReadonlySet<AnyNotNil>, name?: string): void;
10904
+ export declare function logSet(this: void, set: ReadonlySet<number | string>, name?: string): void;
10905
10905
 
10906
10906
  /** Helper function for logging every sound effect that is currently playing. */
10907
10907
  export declare function logSounds(this: void): void;
@@ -18189,6 +18189,8 @@ export declare function smeltTrinkets(player: EntityPlayer, ...trinketTypes: rea
18189
18189
  */
18190
18190
  export declare function some<T>(array: readonly T[], func: (value: T, index: number, array: readonly T[]) => boolean): boolean;
18191
18191
 
18192
+ export declare function sortNormal(a: unknown, b: unknown): -1 | 0 | 1;
18193
+
18192
18194
  /**
18193
18195
  * Helper function to sort an array of objects by one of the object keys.
18194
18196
  *
@@ -18217,7 +18219,7 @@ export declare function sortObjectArrayByKey(key: string): (a: unknown, b: unkno
18217
18219
  *
18218
18220
  * ```ts
18219
18221
  * const myArray = [[1, 2], [2, 3], [3, 4]];
18220
- * myArray.sort(twoDimensionalSort);
18222
+ * myArray.sort(sortTwoDimensionalArray);
18221
18223
  * ```
18222
18224
  *
18223
18225
  * This function also properly handles when the array elements are strings or numbers (instead of
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 84.1.1
3
+ isaacscript-common 84.1.2
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -17055,6 +17055,8 @@ end
17055
17055
  return ____exports
17056
17056
  end,
17057
17057
  ["functions.types"] = function(...)
17058
+ local ____lualib = require("lualib_bundle")
17059
+ local __TS__TypeOf = ____lualib.__TS__TypeOf
17058
17060
  local ____exports = {}
17059
17061
  function ____exports.isNumber(self, variable)
17060
17062
  return type(variable) == "number"
@@ -17164,7 +17166,7 @@ function ____exports.isInteger(self, variable)
17164
17166
  end
17165
17167
  --- Helper function to detect if a variable is a boolean, number, or string.
17166
17168
  function ____exports.isPrimitive(self, variable)
17167
- local variableType = type(variable)
17169
+ local variableType = __TS__TypeOf(variable)
17168
17170
  return variableType == "boolean" or variableType == "number" or variableType == "string"
17169
17171
  end
17170
17172
  function ____exports.isString(self, variable)
@@ -17203,7 +17205,7 @@ local ____types = require("functions.types")
17203
17205
  local isNumber = ____types.isNumber
17204
17206
  local isString = ____types.isString
17205
17207
  local isTable = ____types.isTable
17206
- local function sortNormal(self, a, b)
17208
+ function ____exports.sortNormal(self, a, b)
17207
17209
  if not isNumber(nil, a) and not isString(nil, a) then
17208
17210
  error("Failed to normal sort since the first value was not a number or string and was instead: " .. type(a))
17209
17211
  end
@@ -17245,7 +17247,7 @@ function ____exports.sortObjectArrayByKey(self, key)
17245
17247
  end
17246
17248
  local aValue = a[key]
17247
17249
  local bValue = b[key]
17248
- return sortNormal(nil, aValue, bValue)
17250
+ return ____exports.sortNormal(nil, aValue, bValue)
17249
17251
  end
17250
17252
  end
17251
17253
  --- Helper function to sort a two-dimensional array by the first element.
@@ -17254,7 +17256,7 @@ end
17254
17256
  --
17255
17257
  -- ```ts
17256
17258
  -- const myArray = [[1, 2], [2, 3], [3, 4]];
17257
- -- myArray.sort(twoDimensionalSort);
17259
+ -- myArray.sort(sortTwoDimensionalArray);
17258
17260
  -- ```
17259
17261
  --
17260
17262
  -- This function also properly handles when the array elements are strings or numbers (instead of
@@ -17269,7 +17271,7 @@ function ____exports.sortTwoDimensionalArray(self, a, b)
17269
17271
  error(((((((("Failed to two-dimensional sort since the two elements were disparate types: " .. tostring(a)) .. " & ") .. tostring(b)) .. " (") .. aType) .. " & ") .. bType) .. ")")
17270
17272
  end
17271
17273
  if aType == "string" or aType == "number" then
17272
- return sortNormal(nil, a, b)
17274
+ return ____exports.sortNormal(nil, a, b)
17273
17275
  end
17274
17276
  if aType ~= "table" then
17275
17277
  error("Failed to two-dimensional sort since the first element was not a string, number, or table.")
@@ -17290,7 +17292,7 @@ function ____exports.sortTwoDimensionalArray(self, a, b)
17290
17292
  if elementType1 ~= elementType2 then
17291
17293
  error(((((((("Failed to two-dimensional sort since the first element of each array were disparate types: " .. tostring(firstElement1)) .. " & ") .. tostring(firstElement2)) .. " (") .. elementType1) .. " & ") .. elementType2) .. ")")
17292
17294
  end
17293
- return sortNormal(nil, firstElement1, firstElement2)
17295
+ return ____exports.sortNormal(nil, firstElement1, firstElement2)
17294
17296
  end
17295
17297
  --- Helper function to sort an array in a stable way.
17296
17298
  --
@@ -17299,7 +17301,7 @@ end
17299
17301
  -- Under the hood, this uses the merge sort algorithm.
17300
17302
  function ____exports.stableSort(self, array, sortFunc)
17301
17303
  if sortFunc == nil then
17302
- sortFunc = sortNormal
17304
+ sortFunc = ____exports.sortNormal
17303
17305
  end
17304
17306
  if #array <= 1 then
17305
17307
  return array
@@ -18702,6 +18704,8 @@ local getRandomInt = ____random.getRandomInt
18702
18704
  local ____rng = require("functions.rng")
18703
18705
  local isRNG = ____rng.isRNG
18704
18706
  local newRNG = ____rng.newRNG
18707
+ local ____sort = require("functions.sort")
18708
+ local sortNormal = ____sort.sortNormal
18705
18709
  local ____types = require("functions.types")
18706
18710
  local isNumber = ____types.isNumber
18707
18711
  local isTable = ____types.isTable
@@ -19060,7 +19064,7 @@ function ____exports.getArrayDuplicateElements(self, array)
19060
19064
  set:add(element)
19061
19065
  end
19062
19066
  local values = {__TS__Spread(duplicateElements)}
19063
- return __TS__ArraySort(values)
19067
+ return __TS__ArraySort(values, sortNormal)
19064
19068
  end
19065
19069
  --- Helper function to get an array containing the indexes of an array.
19066
19070
  --
@@ -19272,6 +19276,7 @@ return ____exports
19272
19276
  local ____lualib = require("lualib_bundle")
19273
19277
  local __TS__ArraySort = ____lualib.__TS__ArraySort
19274
19278
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
19279
+ local __TS__ArrayToSorted = ____lualib.__TS__ArrayToSorted
19275
19280
  local __TS__ArrayAt = ____lualib.__TS__ArrayAt
19276
19281
  local __TS__ArrayIncludes = ____lualib.__TS__ArrayIncludes
19277
19282
  local __TS__New = ____lualib.__TS__New
@@ -19280,6 +19285,8 @@ local ____ReadonlySet = require("types.ReadonlySet")
19280
19285
  local ReadonlySet = ____ReadonlySet.ReadonlySet
19281
19286
  local ____array = require("functions.array")
19282
19287
  local getRandomArrayElement = ____array.getRandomArrayElement
19288
+ local ____sort = require("functions.sort")
19289
+ local sortNormal = ____sort.sortNormal
19283
19290
  local ____types = require("functions.types")
19284
19291
  local isNumber = ____types.isNumber
19285
19292
  local isString = ____types.isString
@@ -19415,8 +19422,9 @@ end
19415
19422
  -- Throws an error if the provided enum is empty.
19416
19423
  function ____exports.getHighestEnumValue(self, transpiledEnum)
19417
19424
  local enumValues = ____exports.getEnumValues(nil, transpiledEnum)
19418
- local lastElement = __TS__ArrayAt(enumValues, -1)
19419
- assertDefined(nil, lastElement, "Failed to get the last value from an enum since the enum was empty.")
19425
+ local sortedValues = __TS__ArrayToSorted(enumValues, sortNormal)
19426
+ local lastElement = __TS__ArrayAt(sortedValues, -1)
19427
+ assertDefined(nil, lastElement, "Failed to get the highest value from an enum since the enum was empty.")
19420
19428
  return lastElement
19421
19429
  end
19422
19430
  --- Helper function to get the enum value with the lowest value.
@@ -19427,8 +19435,9 @@ end
19427
19435
  -- Throws an error if the provided enum is empty.
19428
19436
  function ____exports.getLowestEnumValue(self, transpiledEnum)
19429
19437
  local enumValues = ____exports.getEnumValues(nil, transpiledEnum)
19430
- local firstElement = enumValues[1]
19431
- assertDefined(nil, firstElement, "Failed to get the first value from an enum since the enum was empty.")
19438
+ local sortedValues = __TS__ArrayToSorted(enumValues, sortNormal)
19439
+ local firstElement = sortedValues[1]
19440
+ assertDefined(nil, firstElement, "Failed to get the lowest value from an enum since the enum was empty.")
19432
19441
  return firstElement
19433
19442
  end
19434
19443
  --- Helper function to get a random value from the provided enum.
@@ -44332,6 +44341,8 @@ local ____array = require("functions.array")
44332
44341
  local getArrayCombinations = ____array.getArrayCombinations
44333
44342
  local getRandomArrayElement = ____array.getRandomArrayElement
44334
44343
  local sumArray = ____array.sumArray
44344
+ local ____sort = require("functions.sort")
44345
+ local sortNormal = ____sort.sortNormal
44335
44346
  local ____types = require("functions.types")
44336
44347
  local isPrimitive = ____types.isPrimitive
44337
44348
  --- Helper function to get a sorted array based on the contents of a set.
@@ -44347,7 +44358,7 @@ function ____exports.getSortedSetValues(self, set)
44347
44358
  error(("Failed to get the sorted set values because the provided set was of type \"" .. tostring(arrayType)) .. "\". Having sets with non-primitive types doesn't make much sense in general, so you might need to rethink what you are doing.")
44348
44359
  end
44349
44360
  end
44350
- __TS__ArraySort(values)
44361
+ __TS__ArraySort(values, sortNormal)
44351
44362
  return values
44352
44363
  end
44353
44364
  --- Helper function to convert the keys of an object to a set.
@@ -45388,6 +45399,8 @@ local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
45388
45399
  local mapSetPlayer = ____playerDataStructures.mapSetPlayer
45389
45400
  local ____players = require("functions.players")
45390
45401
  local getPlayerFromPtr = ____players.getPlayerFromPtr
45402
+ local ____sort = require("functions.sort")
45403
+ local sortNormal = ____sort.sortNormal
45391
45404
  local ____utils = require("functions.utils")
45392
45405
  local ____repeat = ____utils["repeat"]
45393
45406
  local ____DefaultMap = require("classes.DefaultMap")
@@ -45511,8 +45524,8 @@ function PlayerCollectibleDetection.prototype.checkActiveItemsChanged(self, play
45511
45524
  oldCollectibleTypes[#oldCollectibleTypes + 1] = oldCollectibleType
45512
45525
  newCollectibleTypes[#newCollectibleTypes + 1] = newCollectibleType
45513
45526
  end
45514
- __TS__ArraySort(oldCollectibleTypes)
45515
- __TS__ArraySort(newCollectibleTypes)
45527
+ __TS__ArraySort(oldCollectibleTypes, sortNormal)
45528
+ __TS__ArraySort(newCollectibleTypes, sortNormal)
45516
45529
  if not arrayEquals(nil, oldCollectibleTypes, newCollectibleTypes) then
45517
45530
  self:updateCollectibleMapAndFire(player, nil)
45518
45531
  end
@@ -58456,15 +58469,14 @@ return ____exports
58456
58469
  end,
58457
58470
  ["functions.logMisc"] = function(...)
58458
58471
  local ____lualib = require("lualib_bundle")
58459
- local Map = ____lualib.Map
58460
58472
  local __TS__Spread = ____lualib.__TS__Spread
58461
58473
  local __TS__ArraySort = ____lualib.__TS__ArraySort
58462
58474
  local __TS__ArrayEntries = ____lualib.__TS__ArrayEntries
58463
58475
  local __TS__Iterator = ____lualib.__TS__Iterator
58464
- local Set = ____lualib.Set
58465
58476
  local __TS__TypeOf = ____lualib.__TS__TypeOf
58466
58477
  local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
58467
58478
  local __TS__New = ____lualib.__TS__New
58479
+ local Set = ____lualib.Set
58468
58480
  local ____exports = {}
58469
58481
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.index")
58470
58482
  local BossID = ____isaac_2Dtypescript_2Ddefinitions.BossID
@@ -58521,6 +58533,8 @@ local getRoomListIndex = ____roomData.getRoomListIndex
58521
58533
  local ____set = require("functions.set")
58522
58534
  local combineSets = ____set.combineSets
58523
58535
  local getSortedSetValues = ____set.getSortedSetValues
58536
+ local ____sort = require("functions.sort")
58537
+ local sortNormal = ____sort.sortNormal
58524
58538
  local ____table = require("functions.table")
58525
58539
  local iterateTableInOrder = ____table.iterateTableInOrder
58526
58540
  local ____trinkets = require("functions.trinkets")
@@ -58689,7 +58703,7 @@ function ____exports.logMap(map, name)
58689
58703
  local suffix = name == nil and "" or (" \"" .. name) .. "\""
58690
58704
  log(("Logging a TSTL map" .. suffix) .. ":")
58691
58705
  local mapKeys = {__TS__Spread(map:keys())}
58692
- __TS__ArraySort(mapKeys)
58706
+ __TS__ArraySort(mapKeys, sortNormal)
58693
58707
  for ____, key in ipairs(mapKeys) do
58694
58708
  local value = map:get(key)
58695
58709
  log(((" " .. tostring(key)) .. " --> ") .. tostring(value))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "84.1.2",
3
+ "version": "84.2.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -16,6 +16,7 @@ import {
16
16
  mapSetPlayer,
17
17
  } from "../../../functions/playerDataStructures";
18
18
  import { getPlayerFromPtr } from "../../../functions/players";
19
+ import { sortNormal } from "../../../functions/sort";
19
20
  import { repeat } from "../../../functions/utils";
20
21
  import type { PickingUpItem } from "../../../types/PickingUpItem";
21
22
  import type { PlayerIndex } from "../../../types/PlayerIndex";
@@ -262,8 +263,8 @@ export class PlayerCollectibleDetection extends Feature {
262
263
  // For example, it is possible for the player to switch Schoolbag items, which will cause the
263
264
  // collectibles in the array to be the same, but in a different order. Thus, we sort both arrays
264
265
  // before comparing them.
265
- oldCollectibleTypes.sort();
266
- newCollectibleTypes.sort();
266
+ oldCollectibleTypes.sort(sortNormal);
267
+ newCollectibleTypes.sort(sortNormal);
267
268
 
268
269
  if (!arrayEquals(oldCollectibleTypes, newCollectibleTypes)) {
269
270
  // One or more active items have changed (with the player's total collectible count remaining
@@ -2,6 +2,7 @@ import { ReadonlySet } from "../types/ReadonlySet";
2
2
  import type { WidenLiteral } from "../types/WidenLiteral";
3
3
  import { getRandomInt } from "./random";
4
4
  import { isRNG, newRNG } from "./rng";
5
+ import { sortNormal } from "./sort";
5
6
  import { isNumber, isTable } from "./types";
6
7
  import { assertDefined, eRange } from "./utils";
7
8
 
@@ -359,7 +360,7 @@ function addCombinations<T>(
359
360
  * Helper function to get the duplicate elements in an array. Only one element for each value will
360
361
  * be returned. The elements will be sorted before they are returned.
361
362
  */
362
- export function getArrayDuplicateElements<T>(
363
+ export function getArrayDuplicateElements<T extends number | string>(
363
364
  array: readonly T[],
364
365
  ): readonly T[] {
365
366
  const duplicateElements = new Set<T>();
@@ -373,7 +374,7 @@ export function getArrayDuplicateElements<T>(
373
374
  }
374
375
 
375
376
  const values = [...duplicateElements];
376
- return values.sort();
377
+ return values.sort(sortNormal);
377
378
  }
378
379
 
379
380
  /**
@@ -1,5 +1,6 @@
1
1
  import { ReadonlySet } from "../types/ReadonlySet";
2
2
  import { getRandomArrayElement } from "./array";
3
+ import { sortNormal } from "./sort";
3
4
  import { isNumber, isString } from "./types";
4
5
  import { assertDefined, iRange } from "./utils";
5
6
 
@@ -151,11 +152,11 @@ export function getHighestEnumValue<T extends TranspiledEnum>(
151
152
  transpiledEnum: T,
152
153
  ): T[keyof T] {
153
154
  const enumValues = getEnumValues(transpiledEnum);
154
-
155
- const lastElement = enumValues.at(-1);
155
+ const sortedValues = enumValues.toSorted(sortNormal);
156
+ const lastElement = sortedValues.at(-1);
156
157
  assertDefined(
157
158
  lastElement,
158
- "Failed to get the last value from an enum since the enum was empty.",
159
+ "Failed to get the highest value from an enum since the enum was empty.",
159
160
  );
160
161
 
161
162
  return lastElement;
@@ -173,11 +174,11 @@ export function getLowestEnumValue<T extends TranspiledEnum>(
173
174
  transpiledEnum: T,
174
175
  ): T[keyof T] {
175
176
  const enumValues = getEnumValues(transpiledEnum);
176
-
177
- const firstElement = enumValues[0];
177
+ const sortedValues = enumValues.toSorted(sortNormal);
178
+ const firstElement = sortedValues[0];
178
179
  assertDefined(
179
180
  firstElement,
180
- "Failed to get the first value from an enum since the enum was empty.",
181
+ "Failed to get the lowest value from an enum since the enum was empty.",
181
182
  );
182
183
 
183
184
  return firstElement;
@@ -38,6 +38,7 @@ import { getPlayerHealth } from "./playerHealth";
38
38
  import { getPlayerName } from "./players";
39
39
  import { getRoomData, getRoomGridIndex, getRoomListIndex } from "./roomData";
40
40
  import { combineSets, getSortedSetValues } from "./set";
41
+ import { sortNormal } from "./sort";
41
42
  import { iterateTableInOrder } from "./table";
42
43
  import { getTrinketName } from "./trinkets";
43
44
  import { isDefaultMap, isTSTLMap, isTSTLSet } from "./tstlClass";
@@ -257,7 +258,7 @@ export function logLevelStateFlags(this: void): void {
257
258
  */
258
259
  export function logMap(
259
260
  this: void,
260
- map: ReadonlyMap<AnyNotNil, unknown>,
261
+ map: ReadonlyMap<number | string, unknown>,
261
262
  name?: string,
262
263
  ): void {
263
264
  if (!isTSTLMap(map) && !isDefaultMap(map)) {
@@ -269,11 +270,10 @@ export function logMap(
269
270
  log(`Logging a TSTL map${suffix}:`);
270
271
 
271
272
  const mapKeys = [...map.keys()];
272
- mapKeys.sort();
273
+ mapKeys.sort(sortNormal);
273
274
 
274
275
  for (const key of mapKeys) {
275
276
  const value = map.get(key);
276
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
277
277
  log(` ${key} --> ${value}`);
278
278
  }
279
279
 
@@ -405,7 +405,7 @@ export function logSeedEffects(this: void): void {
405
405
  */
406
406
  export function logSet(
407
407
  this: void,
408
- set: ReadonlySet<AnyNotNil>,
408
+ set: ReadonlySet<number | string>,
409
409
  name?: string,
410
410
  ): void {
411
411
  if (!isTSTLSet(set)) {
@@ -418,7 +418,6 @@ export function logSet(
418
418
 
419
419
  const setValues = getSortedSetValues(set);
420
420
  for (const value of setValues) {
421
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
422
421
  log(` Value: ${value}`);
423
422
  }
424
423
 
@@ -510,7 +509,7 @@ export function logTableDifferences<K extends AnyNotNil, V>(
510
509
 
511
510
  const keysSet = combineSets(table1KeysSet, table2KeysSet);
512
511
  const keys = [...keysSet.values()];
513
- keys.sort();
512
+ keys.sort(); // eslint-disable-line @typescript-eslint/require-array-sort-compare
514
513
 
515
514
  for (const key of keys) {
516
515
  const value1 = table1.get(key);
@@ -1,5 +1,6 @@
1
1
  import { ReadonlySet } from "../types/ReadonlySet";
2
2
  import { getArrayCombinations, getRandomArrayElement, sumArray } from "./array";
3
+ import { sortNormal } from "./sort";
3
4
  import { isPrimitive } from "./types";
4
5
 
5
6
  /**
@@ -78,7 +79,7 @@ export function deleteSetsFromSet<T>(
78
79
  * a random seed.
79
80
  * @param exceptions Optional. An array of elements to skip over if selected.
80
81
  */
81
- export function getRandomSetElement<T>(
82
+ export function getRandomSetElement<T extends number | string>(
82
83
  set: ReadonlySet<T>,
83
84
  seedOrRNG: Seed | RNG | undefined,
84
85
  exceptions: readonly T[] = [],
@@ -106,7 +107,7 @@ export function getRandomSetElement<T>(
106
107
  * @param set The set to get the combinations of.
107
108
  * @param includeEmptyArray Whether to include an empty array in the combinations.
108
109
  */
109
- export function getSetCombinations<T>(
110
+ export function getSetCombinations<T extends number | string>(
110
111
  set: ReadonlySet<T>,
111
112
  includeEmptyArray: boolean,
112
113
  ): ReadonlyArray<ReadonlySet<T>> {
@@ -123,7 +124,9 @@ export function getSetCombinations<T>(
123
124
  * the contents is important.
124
125
  */
125
126
  // eslint-disable-next-line isaacscript/no-mutable-return
126
- export function getSortedSetValues<T>(set: ReadonlySet<T>): T[] {
127
+ export function getSortedSetValues<T extends number | string>(
128
+ set: ReadonlySet<T>,
129
+ ): T[] {
127
130
  const values = [...set];
128
131
 
129
132
  // Check for problematic types in order to throw a helpful error message.
@@ -137,7 +140,7 @@ export function getSortedSetValues<T>(set: ReadonlySet<T>): T[] {
137
140
  }
138
141
  }
139
142
 
140
- values.sort();
143
+ values.sort(sortNormal);
141
144
 
142
145
  return values;
143
146
  }
@@ -1,6 +1,6 @@
1
1
  import { isNumber, isString, isTable } from "./types";
2
2
 
3
- function sortNormal(a: unknown, b: unknown): -1 | 0 | 1 {
3
+ export function sortNormal(a: unknown, b: unknown): -1 | 0 | 1 {
4
4
  if (!isNumber(a) && !isString(a)) {
5
5
  error(
6
6
  `Failed to normal sort since the first value was not a number or string and was instead: ${type(
@@ -79,7 +79,7 @@ export function sortObjectArrayByKey(key: string) {
79
79
  *
80
80
  * ```ts
81
81
  * const myArray = [[1, 2], [2, 3], [3, 4]];
82
- * myArray.sort(twoDimensionalSort);
82
+ * myArray.sort(sortTwoDimensionalArray);
83
83
  * ```
84
84
  *
85
85
  * This function also properly handles when the array elements are strings or numbers (instead of
@@ -186,7 +186,7 @@ export function iterateTableInOrder<K extends AnyNotNil, V>(
186
186
  return;
187
187
  }
188
188
 
189
- keys.sort();
189
+ keys.sort(); // eslint-disable-line @typescript-eslint/require-array-sort-compare
190
190
  for (const key of keys) {
191
191
  const keyIndex = key as unknown as K;
192
192
  const value = luaMap.get(keyIndex);
@@ -171,12 +171,12 @@ export function asTrinketType(num: int): TrinketType {
171
171
  }
172
172
 
173
173
  export function isBoolean(variable: unknown): variable is boolean {
174
- return type(variable) === "boolean";
174
+ return typeof variable === "boolean";
175
175
  }
176
176
 
177
177
  // eslint-disable-next-line @typescript-eslint/ban-types
178
178
  export function isFunction(variable: unknown): variable is Function {
179
- return type(variable) === "function";
179
+ return typeof variable === "function";
180
180
  }
181
181
 
182
182
  export function isInteger(variable: unknown): variable is int {
@@ -188,14 +188,14 @@ export function isInteger(variable: unknown): variable is int {
188
188
  }
189
189
 
190
190
  export function isNumber(variable: unknown): variable is number {
191
- return type(variable) === "number";
191
+ return typeof variable === "number";
192
192
  }
193
193
 
194
194
  /** Helper function to detect if a variable is a boolean, number, or string. */
195
195
  export function isPrimitive(
196
196
  variable: unknown,
197
197
  ): variable is boolean | number | string {
198
- const variableType = type(variable);
198
+ const variableType = typeof variable;
199
199
  return (
200
200
  variableType === "boolean" ||
201
201
  variableType === "number" ||
@@ -204,16 +204,18 @@ export function isPrimitive(
204
204
  }
205
205
 
206
206
  export function isString(variable: unknown): variable is string {
207
- return type(variable) === "string";
207
+ return typeof variable === "string";
208
208
  }
209
209
 
210
210
  export function isTable(
211
211
  variable: unknown,
212
212
  ): variable is LuaMap<AnyNotNil, unknown> {
213
+ // We cannot use `typeof` here since "table" is not a JavaScript type.
213
214
  return type(variable) === "table";
214
215
  }
215
216
 
216
217
  export function isUserdata(variable: unknown): variable is LuaUserdata {
218
+ // We cannot use `typeof` here since "userdata" is not a JavaScript type.
217
219
  return type(variable) === "userdata";
218
220
  }
219
221