isaacscript-common 8.1.0 → 8.3.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.
@@ -50,6 +50,7 @@ function initMap(self)
50
50
  extraConsoleCommandsFunctionMap:set("card", commands.card)
51
51
  extraConsoleCommandsFunctionMap:set("cards", commands.cards)
52
52
  extraConsoleCommandsFunctionMap:set("cc", commands.cc)
53
+ extraConsoleCommandsFunctionMap:set("getChallenge", commands.getChallenge)
53
54
  extraConsoleCommandsFunctionMap:set("chaosCardTears", commands.chaosCardTears)
54
55
  extraConsoleCommandsFunctionMap:set("character", commands.characterCommand)
55
56
  extraConsoleCommandsFunctionMap:set("charge", commands.charge)
@@ -69,6 +69,8 @@ export declare function card(params: string): void;
69
69
  export declare function cards(): void;
70
70
  /** Alias for the "chaosCardTears" command. */
71
71
  export declare function cc(): void;
72
+ /** Displays the current challenge, if any. */
73
+ export declare function getChallenge(): void;
72
74
  /**
73
75
  * Toggles Chaos Card tears for the player. Useful for killing enemies very fast without using
74
76
  * "debug 10".
@@ -1 +1 @@
1
- {"version":3,"file":"listCommands.d.ts","sourceRoot":"","sources":["../../../src/features/extraConsoleCommands/listCommands.ts"],"names":[],"mappings":"AA4GA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA2C/C;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAEhC;AAED,gEAAgE;AAChE,wBAAgB,MAAM,IAAI,IAAI,CAK7B;AAED,sEAAsE;AACtE,wBAAgB,OAAO,IAAI,IAAI,CAkB9B;AAED,2CAA2C;AAC3C,wBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEvC;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED,+CAA+C;AAC/C,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED;;;GAGG;AACH,wBA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G;AACH,wBAAgB,KAAK,IAAI,IAAI,CAQ5B;AAED,wCAAwC;AACxC,wBAAgB,KAAK,IAAI,IAAI,CAE5B;AAED,6CAA6C;AAC7C,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED,qDAAqD;AACrD,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED,yDAAyD;AACzD,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED,sFAAsF;AACtF,wBAAgB,MAAM,IAAI,IAAI,CAQ7B;AAED,wFAAwF;AACxF,wBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEvC;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA0BzC"}
1
+ {"version":3,"file":"listCommands.d.ts","sourceRoot":"","sources":["../../../src/features/extraConsoleCommands/listCommands.ts"],"names":[],"mappings":"AA6GA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA2C/C;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAEhC;AAED,gEAAgE;AAChE,wBAAgB,MAAM,IAAI,IAAI,CAK7B;AAED,sEAAsE;AACtE,wBAAgB,OAAO,IAAI,IAAI,CAkB9B;AAED,2CAA2C;AAC3C,wBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEvC;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED,+CAA+C;AAC/C,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAcjD;AAED,2CAA2C;AAC3C,wBAAgB,EAAE,IAAI,IAAI,CAEzB;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAczC;AAED;;;GAGG;AACH,wBA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AED,qDAAqD;AACrD,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED,yDAAyD;AACzD,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED,sFAAsF;AACtF,wBAAgB,MAAM,IAAI,IAAI,CAQ7B;AAED,wFAAwF;AACxF,wBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEvC;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA0BzC"}
@@ -8,6 +8,7 @@ local ____exports = {}
8
8
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
9
9
  local ActiveSlot = ____isaac_2Dtypescript_2Ddefinitions.ActiveSlot
10
10
  local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
11
+ local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
11
12
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
12
13
  local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
13
14
  local DisplayFlag = ____isaac_2Dtypescript_2Ddefinitions.DisplayFlag
@@ -413,6 +414,13 @@ end
413
414
  function ____exports.cc(self)
414
415
  ____exports.chaosCardTears(nil)
415
416
  end
417
+ --- Displays the current challenge, if any.
418
+ function ____exports.getChallenge(self)
419
+ local challenge = Isaac.GetChallenge()
420
+ local challengeName = Challenge[challenge]
421
+ local challengeDescription = challengeName == nil and tostring(challenge) .. " (custom)" or ((("Challenge." .. challengeName) .. " (") .. tostring(challenge)) .. ")"
422
+ printConsole(nil, "The current challenge is: " .. challengeDescription)
423
+ end
416
424
  --- Restart as the specified character. Accepts either the character sub-type or the partial name of
417
425
  -- the character.
418
426
  --
@@ -1 +1 @@
1
- {"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/functions/map.ts"],"names":[],"mappings":"AAEA,mGAAmG;AACnG,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAO1D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,GAC1B,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,SAAS,CAuBzB;AAED,4DAA4D;AAC5D,wBAAgB,MAAM,CACpB,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,GACvD,MAAM,CAGR"}
1
+ {"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/functions/map.ts"],"names":[],"mappings":"AAGA,mGAAmG;AACnG,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAO1D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,GAC1B,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,SAAS,CAgBzB;AAED,4DAA4D;AAC5D,wBAAgB,MAAM,CACpB,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,GACvD,MAAM,CAGR"}
@@ -3,13 +3,11 @@ local Map = ____lualib.Map
3
3
  local __TS__New = ____lualib.__TS__New
4
4
  local __TS__Iterator = ____lualib.__TS__Iterator
5
5
  local __TS__Spread = ____lualib.__TS__Spread
6
- local __TS__ArraySort = ____lualib.__TS__ArraySort
7
- local __TS__StringReplaceAll = ____lualib.__TS__StringReplaceAll
8
- local __TS__StringStartsWith = ____lualib.__TS__StringStartsWith
9
- local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
10
6
  local ____exports = {}
11
7
  local ____array = require("functions.array")
12
8
  local sumArray = ____array.sumArray
9
+ local ____string = require("functions.string")
10
+ local getPartialMatch = ____string.getPartialMatch
13
11
  --- Helper function to copy a map. (You can also use a Map constructor to accomplish this task.)
14
12
  function ____exports.copyMap(self, oldMap)
15
13
  local newMap = __TS__New(Map)
@@ -39,24 +37,13 @@ end
39
37
  -- ```
40
38
  function ____exports.getMapPartialMatch(self, searchText, map)
41
39
  local keys = {__TS__Spread(map:keys())}
42
- __TS__ArraySort(keys)
43
- searchText = string.lower(searchText)
44
- searchText = __TS__StringReplaceAll(searchText, " ", "")
45
- local matchingKeys = __TS__ArrayFilter(
46
- keys,
47
- function(____, key) return __TS__StringStartsWith(
48
- string.lower(key),
49
- searchText
50
- ) end
51
- )
52
- __TS__ArraySort(matchingKeys)
53
- local matchingKey = matchingKeys[1]
40
+ local matchingKey = getPartialMatch(nil, searchText, keys)
54
41
  if matchingKey == nil then
55
42
  return nil
56
43
  end
57
44
  local value = map:get(matchingKey)
58
45
  if value == nil then
59
- return nil
46
+ error("Failed to get the map value corresponding to the partial match of: " .. matchingKey)
60
47
  end
61
48
  return {matchingKey, value}
62
49
  end
@@ -1,4 +1,21 @@
1
1
  export declare function capitalizeFirstLetter(string: string): string;
2
+ /**
3
+ * Helper function to get the closest value from an array of strings based on partial search text.
4
+ * For the purposes of this function, both search text and the array are converted to lowercase
5
+ * before attempting to find a match.
6
+ *
7
+ * For example:
8
+ *
9
+ * ```ts
10
+ * const array = ["foo", "bar"];
11
+ * const searchText = "f";
12
+ * const match = getPartialMatch(array, searchText); // match is now equal to "foo"
13
+ *
14
+ * @returns If a match was found, returns the array element. If a match was not
15
+ * found, returns undefined.
16
+ * ```
17
+ */
18
+ export declare function getPartialMatch(searchText: string, array: string[]): string | undefined;
2
19
  export declare function removeAllCharacters(string: string, character: string): string;
3
20
  /**
4
21
  * Helper function to remove all of the characters in a string before a given substring. Returns the
@@ -1 +1 @@
1
- {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/functions/string.ts"],"names":[],"mappings":"AAAA,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAM5D;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,MAAM,CAGR;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,GAAG,UAAU,EAAE,MAAM,EAAE,GACtB,MAAM,CAMR;AAED,gGAAgG;AAChG,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMjE;AAED,gGAAgG;AAChG,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAOjE"}
1
+ {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/functions/string.ts"],"names":[],"mappings":"AAAA,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAM5D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EAAE,GACd,MAAM,GAAG,SAAS,CAYpB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,MAAM,CAGR;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,GAAG,UAAU,EAAE,MAAM,EAAE,GACtB,MAAM,CAMR;AAED,gGAAgG;AAChG,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMjE;AAED,gGAAgG;AAChG,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAOjE"}
@@ -1,7 +1,9 @@
1
1
  local ____lualib = require("lualib_bundle")
2
+ local __TS__ArraySort = ____lualib.__TS__ArraySort
2
3
  local __TS__StringReplaceAll = ____lualib.__TS__StringReplaceAll
3
- local __TS__StringSlice = ____lualib.__TS__StringSlice
4
4
  local __TS__StringStartsWith = ____lualib.__TS__StringStartsWith
5
+ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
6
+ local __TS__StringSlice = ____lualib.__TS__StringSlice
5
7
  local __TS__StringEndsWith = ____lualib.__TS__StringEndsWith
6
8
  local ____exports = {}
7
9
  function ____exports.capitalizeFirstLetter(self, ____string)
@@ -10,6 +12,34 @@ function ____exports.capitalizeFirstLetter(self, ____string)
10
12
  local restOfString = string.sub(____string, 2)
11
13
  return capitalizedFirstLetter .. restOfString
12
14
  end
15
+ --- Helper function to get the closest value from an array of strings based on partial search text.
16
+ -- For the purposes of this function, both search text and the array are converted to lowercase
17
+ -- before attempting to find a match.
18
+ --
19
+ -- For example:
20
+ --
21
+ -- ```ts
22
+ -- const array = ["foo", "bar"];
23
+ -- const searchText = "f";
24
+ -- const match = getPartialMatch(array, searchText); // match is now equal to "foo"
25
+ --
26
+ -- @returns If a match was found, returns the array element. If a match was not
27
+ -- found, returns undefined.
28
+ -- ```
29
+ function ____exports.getPartialMatch(self, searchText, array)
30
+ __TS__ArraySort(array)
31
+ searchText = string.lower(searchText)
32
+ searchText = __TS__StringReplaceAll(searchText, " ", "")
33
+ local matchingElements = __TS__ArrayFilter(
34
+ array,
35
+ function(____, element) return __TS__StringStartsWith(
36
+ string.lower(element),
37
+ searchText
38
+ ) end
39
+ )
40
+ __TS__ArraySort(matchingElements)
41
+ return matchingElements[1]
42
+ end
13
43
  function ____exports.removeAllCharacters(self, ____string, character)
14
44
  return __TS__StringReplaceAll(____string, character, "")
15
45
  end
@@ -80,13 +80,13 @@ export declare function repeat(n: int, func: (i: int) => void): void;
80
80
  /**
81
81
  * Helper function to signify that the enclosing code block is not yet complete. Using this function
82
82
  * is similar to writing a "TODO" comment, but it has the benefit of preventing ESLint errors due to
83
- * early returns.
83
+ * unused variables or early returns.
84
84
  *
85
85
  * When you see this function, it simply means that the programmer intends to add in more code to
86
86
  * this spot later.
87
87
  *
88
88
  * This function is variadic, meaning that you can pass as many arguments as you want. (This is
89
- * useful as a means to prevent lint warnings.)
89
+ * useful as a means to prevent unused variables.)
90
90
  *
91
91
  * This function does not actually do anything. (It is an "empty" function.)
92
92
  */
@@ -153,13 +153,13 @@ ____exports["repeat"] = function(self, n, func)
153
153
  end
154
154
  --- Helper function to signify that the enclosing code block is not yet complete. Using this function
155
155
  -- is similar to writing a "TODO" comment, but it has the benefit of preventing ESLint errors due to
156
- -- early returns.
156
+ -- unused variables or early returns.
157
157
  --
158
158
  -- When you see this function, it simply means that the programmer intends to add in more code to
159
159
  -- this spot later.
160
160
  --
161
161
  -- This function is variadic, meaning that you can pass as many arguments as you want. (This is
162
- -- useful as a means to prevent lint warnings.)
162
+ -- useful as a means to prevent unused variables.)
163
163
  --
164
164
  -- This function does not actually do anything. (It is an "empty" function.)
165
165
  function ____exports.todo(self, ...)
package/dist/index.d.ts CHANGED
@@ -3790,6 +3790,24 @@ export declare function getOppositeDoorSlot(doorSlot: DoorSlot): DoorSlot | unde
3790
3790
  */
3791
3791
  export declare function getOtherPlayers(player: EntityPlayer): EntityPlayer[];
3792
3792
 
3793
+ /**
3794
+ * Helper function to get the closest value from an array of strings based on partial search text.
3795
+ * For the purposes of this function, both search text and the array are converted to lowercase
3796
+ * before attempting to find a match.
3797
+ *
3798
+ * For example:
3799
+ *
3800
+ * ```ts
3801
+ * const array = ["foo", "bar"];
3802
+ * const searchText = "f";
3803
+ * const match = getPartialMatch(array, searchText); // match is now equal to "foo"
3804
+ *
3805
+ * @returns If a match was found, returns the array element. If a match was not
3806
+ * found, returns undefined.
3807
+ * ```
3808
+ */
3809
+ export declare function getPartialMatch(searchText: string, array: string[]): string | undefined;
3810
+
3793
3811
  /**
3794
3812
  * Helper function to get the associated pill effect after PHD is acquired. If a pill effect is not
3795
3813
  * altered by PHD, then the same pill effect will be returned.
@@ -11212,13 +11230,13 @@ export declare function texelEquals(sprite1: Sprite, sprite2: Sprite, position:
11212
11230
  /**
11213
11231
  * Helper function to signify that the enclosing code block is not yet complete. Using this function
11214
11232
  * is similar to writing a "TODO" comment, but it has the benefit of preventing ESLint errors due to
11215
- * early returns.
11233
+ * unused variables or early returns.
11216
11234
  *
11217
11235
  * When you see this function, it simply means that the programmer intends to add in more code to
11218
11236
  * this spot later.
11219
11237
  *
11220
11238
  * This function is variadic, meaning that you can pass as many arguments as you want. (This is
11221
- * useful as a means to prevent lint warnings.)
11239
+ * useful as a means to prevent unused variables.)
11222
11240
  *
11223
11241
  * This function does not actually do anything. (It is an "empty" function.)
11224
11242
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "8.1.0",
3
+ "version": "8.3.1",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -54,6 +54,7 @@ function initMap() {
54
54
  extraConsoleCommandsFunctionMap.set("card", commands.card);
55
55
  extraConsoleCommandsFunctionMap.set("cards", commands.cards);
56
56
  extraConsoleCommandsFunctionMap.set("cc", commands.cc);
57
+ extraConsoleCommandsFunctionMap.set("getChallenge", commands.getChallenge);
57
58
  extraConsoleCommandsFunctionMap.set(
58
59
  "chaosCardTears",
59
60
  commands.chaosCardTears,
@@ -25,6 +25,7 @@ import {
25
25
  ActiveSlot,
26
26
  CacheFlag,
27
27
  Card,
28
+ Challenge,
28
29
  CollectibleType,
29
30
  Direction,
30
31
  DisplayFlag,
@@ -373,6 +374,17 @@ export function cc(): void {
373
374
  chaosCardTears();
374
375
  }
375
376
 
377
+ /** Displays the current challenge, if any. */
378
+ export function getChallenge(): void {
379
+ const challenge = Isaac.GetChallenge();
380
+ const challengeName = Challenge[challenge];
381
+ const challengeDescription =
382
+ challengeName === undefined
383
+ ? `${challenge} (custom)`
384
+ : `Challenge.${challengeName} (${challenge})`;
385
+ printConsole(`The current challenge is: ${challengeDescription}`);
386
+ }
387
+
376
388
  /**
377
389
  * Toggles Chaos Card tears for the player. Useful for killing enemies very fast without using
378
390
  * "debug 10".
@@ -1,4 +1,5 @@
1
1
  import { sumArray } from "./array";
2
+ import { getPartialMatch } from "./string";
2
3
 
3
4
  /** Helper function to copy a map. (You can also use a Map constructor to accomplish this task.) */
4
5
  export function copyMap<K, V>(oldMap: Map<K, V>): Map<K, V> {
@@ -34,24 +35,17 @@ export function getMapPartialMatch<T>(
34
35
  map: ReadonlyMap<string, T>,
35
36
  ): [string, T] | undefined {
36
37
  const keys = [...map.keys()];
37
- keys.sort();
38
38
 
39
- searchText = searchText.toLowerCase();
40
- searchText = searchText.replaceAll(" ", "");
41
-
42
- const matchingKeys = keys.filter((key) =>
43
- key.toLowerCase().startsWith(searchText),
44
- );
45
- matchingKeys.sort();
46
-
47
- const matchingKey = matchingKeys[0];
39
+ const matchingKey = getPartialMatch(searchText, keys);
48
40
  if (matchingKey === undefined) {
49
41
  return undefined;
50
42
  }
51
43
 
52
44
  const value = map.get(matchingKey);
53
45
  if (value === undefined) {
54
- return undefined;
46
+ error(
47
+ `Failed to get the map value corresponding to the partial match of: ${matchingKey}`,
48
+ );
55
49
  }
56
50
 
57
51
  return [matchingKey, value];
@@ -6,6 +6,39 @@ export function capitalizeFirstLetter(string: string): string {
6
6
  return `${capitalizedFirstLetter}${restOfString}`;
7
7
  }
8
8
 
9
+ /**
10
+ * Helper function to get the closest value from an array of strings based on partial search text.
11
+ * For the purposes of this function, both search text and the array are converted to lowercase
12
+ * before attempting to find a match.
13
+ *
14
+ * For example:
15
+ *
16
+ * ```ts
17
+ * const array = ["foo", "bar"];
18
+ * const searchText = "f";
19
+ * const match = getPartialMatch(array, searchText); // match is now equal to "foo"
20
+ *
21
+ * @returns If a match was found, returns the array element. If a match was not
22
+ * found, returns undefined.
23
+ * ```
24
+ */
25
+ export function getPartialMatch(
26
+ searchText: string,
27
+ array: string[],
28
+ ): string | undefined {
29
+ array.sort();
30
+
31
+ searchText = searchText.toLowerCase();
32
+ searchText = searchText.replaceAll(" ", "");
33
+
34
+ const matchingElements = array.filter((element) =>
35
+ element.toLowerCase().startsWith(searchText),
36
+ );
37
+ matchingElements.sort();
38
+
39
+ return matchingElements[0];
40
+ }
41
+
9
42
  export function removeAllCharacters(string: string, character: string): string {
10
43
  return string.replaceAll(character, "");
11
44
  }
@@ -182,13 +182,13 @@ export function repeat(n: int, func: (i: int) => void): void {
182
182
  /**
183
183
  * Helper function to signify that the enclosing code block is not yet complete. Using this function
184
184
  * is similar to writing a "TODO" comment, but it has the benefit of preventing ESLint errors due to
185
- * early returns.
185
+ * unused variables or early returns.
186
186
  *
187
187
  * When you see this function, it simply means that the programmer intends to add in more code to
188
188
  * this spot later.
189
189
  *
190
190
  * This function is variadic, meaning that you can pass as many arguments as you want. (This is
191
- * useful as a means to prevent lint warnings.)
191
+ * useful as a means to prevent unused variables.)
192
192
  *
193
193
  * This function does not actually do anything. (It is an "empty" function.)
194
194
  */