isaacscript-common 17.4.1 → 17.4.2

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/index.d.ts CHANGED
@@ -1363,8 +1363,10 @@ export declare function combineSets<T>(...sets: Array<Set<T> | ReadonlySet<T>>):
1363
1363
  /**
1364
1364
  * Helper function to get the enum name for the specified `Controller` value. Note that this will
1365
1365
  * trim off the "BUTTON_" prefix.
1366
+ *
1367
+ * Returns undefined if the submitted controller value was not valid.
1366
1368
  */
1367
- export declare function controllerToString(controller: Controller): string;
1369
+ export declare function controllerToString(controller: Controller): string | undefined;
1368
1370
 
1369
1371
  /**
1370
1372
  * This is the type that is fed to `registerCharacterHealthConversion` helper function to signify
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 17.4.1
3
+ isaacscript-common 17.4.2
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -34847,6 +34847,9 @@ local SHOOTING_ACTIONS = {ButtonAction.SHOOT_LEFT, ButtonAction.SHOOT_RIGHT, But
34847
34847
  ____exports.SHOOTING_ACTIONS_SET = __TS__New(Set, SHOOTING_ACTIONS)
34848
34848
  function ____exports.controllerToString(self, controller)
34849
34849
  local key = Controller[controller]
34850
+ if key == nil then
34851
+ return nil
34852
+ end
34850
34853
  return trimPrefix(nil, key, "BUTTON_")
34851
34854
  end
34852
34855
  function ____exports.getMoveActions(self)
@@ -4,8 +4,10 @@ export declare const SHOOTING_ACTIONS_SET: ReadonlySet<ButtonAction>;
4
4
  /**
5
5
  * Helper function to get the enum name for the specified `Controller` value. Note that this will
6
6
  * trim off the "BUTTON_" prefix.
7
+ *
8
+ * Returns undefined if the submitted controller value was not valid.
7
9
  */
8
- export declare function controllerToString(controller: Controller): string;
10
+ export declare function controllerToString(controller: Controller): string | undefined;
9
11
  export declare function getMoveActions(): ReadonlySet<ButtonAction>;
10
12
  export declare function getShootActions(): ReadonlySet<ButtonAction>;
11
13
  /** Iterates over all inputs to determine if a particular button is pressed (i.e. held down). */
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/functions/input.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,UAAU,EAEV,QAAQ,EACT,MAAM,8BAA8B,CAAC;AAuBtC,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,YAAY,CAE1D,CAAC;AASF,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,YAAY,CAE1D,CAAC;AAEF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAGjE;AAED,wBAAgB,cAAc,IAAI,WAAW,CAAC,YAAY,CAAC,CAE1D;AAED,wBAAgB,eAAe,IAAI,WAAW,CAAC,YAAY,CAAC,CAE3D;AAED,gGAAgG;AAChG,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAK7E;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,YAAY,GACzB,OAAO,CAKT;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAI9D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAEhE;AAED,wBAAgB,6BAA6B,IAAI,OAAO,CAIvD;AAED,wBAAgB,+BAA+B,IAAI,OAAO,CAIzD;AAED,wBAAgB,aAAa,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAEjE;AAED,wBAAgB,8BAA8B,IAAI,OAAO,CAIxD;AAED,wBAAgB,gCAAgC,IAAI,OAAO,CAI1D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,OAAO,GACjB,MAAM,GAA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13 @@ local SHOOTING_ACTIONS = {ButtonAction.SHOOT_LEFT, ButtonAction.SHOOT_RIGHT, But
30
30
  ____exports.SHOOTING_ACTIONS_SET = __TS__New(Set, SHOOTING_ACTIONS)
31
31
  --- Helper function to get the enum name for the specified `Controller` value. Note that this will
32
32
  -- trim off the "BUTTON_" prefix.
33
+ --
34
+ -- Returns undefined if the submitted controller value was not valid.
33
35
  function ____exports.controllerToString(self, controller)
34
36
  local key = Controller[controller]
37
+ if key == nil then
38
+ return nil
39
+ end
35
40
  return trimPrefix(nil, key, "BUTTON_")
36
41
  end
37
42
  function ____exports.getMoveActions(self)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "17.4.1",
3
+ "version": "17.4.2",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -44,9 +44,16 @@ export const SHOOTING_ACTIONS_SET: ReadonlySet<ButtonAction> = new Set(
44
44
  /**
45
45
  * Helper function to get the enum name for the specified `Controller` value. Note that this will
46
46
  * trim off the "BUTTON_" prefix.
47
+ *
48
+ * Returns undefined if the submitted controller value was not valid.
47
49
  */
48
- export function controllerToString(controller: Controller): string {
50
+ export function controllerToString(controller: Controller): string | undefined {
49
51
  const key = Controller[controller];
52
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
53
+ if (key === undefined) {
54
+ return undefined;
55
+ }
56
+
50
57
  return trimPrefix(key, "BUTTON_");
51
58
  }
52
59