isaacscript-common 1.2.264 → 1.2.267
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/functions/array.d.ts +16 -0
- package/dist/functions/array.lua +36 -0
- package/dist/maps/cardMap.lua +9 -1
- package/package.json +1 -1
|
@@ -19,6 +19,22 @@ export declare function arrayRemove<T>(originalArray: T[] | readonly T[], ...ele
|
|
|
19
19
|
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
20
20
|
*/
|
|
21
21
|
export declare function arrayRemoveInPlace<T>(array: T[], ...elementsToRemove: T[]): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Shallow copies and removes the elements at the specified indexes from the array. Returns the
|
|
24
|
+
* copied array. If the specified indexes are not found in the array, it will simply return a
|
|
25
|
+
* shallow copy of the array.
|
|
26
|
+
*
|
|
27
|
+
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
28
|
+
*/
|
|
29
|
+
export declare function arrayRemoveIndex<T>(originalArray: T[] | readonly T[], ...indexesToRemove: int[]): T[];
|
|
30
|
+
/**
|
|
31
|
+
* Removes the elements at the specified indexes from the array. If the specified indexes are not
|
|
32
|
+
* found in the array, this function will do nothing. Returns whether or not one or more elements
|
|
33
|
+
* were removed.
|
|
34
|
+
*
|
|
35
|
+
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
36
|
+
*/
|
|
37
|
+
export declare function arrayRemoveIndexInPlace<T>(array: T[], ...indexesToRemove: int[]): boolean;
|
|
22
38
|
export declare function arrayToString<T>(array: T[]): string;
|
|
23
39
|
/**
|
|
24
40
|
* Helper function to combine two or more arrays. Returns a new array that is the composition of all
|
package/dist/functions/array.lua
CHANGED
|
@@ -4,6 +4,9 @@ local Set = ____lualib.Set
|
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local __TS__ArrayIndexOf = ____lualib.__TS__ArrayIndexOf
|
|
6
6
|
local __TS__ArraySplice = ____lualib.__TS__ArraySplice
|
|
7
|
+
local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
|
|
8
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
9
|
+
local __TS__ArraySort = ____lualib.__TS__ArraySort
|
|
7
10
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
8
11
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
9
12
|
local __TS__ArrayReduce = ____lualib.__TS__ArrayReduce
|
|
@@ -72,6 +75,39 @@ function ____exports.arrayRemoveInPlace(self, array, ...)
|
|
|
72
75
|
end
|
|
73
76
|
return removedOneOrMoreElements
|
|
74
77
|
end
|
|
78
|
+
function ____exports.arrayRemoveIndex(self, originalArray, ...)
|
|
79
|
+
local indexesToRemove = {...}
|
|
80
|
+
local indexesToRemoveSet = __TS__New(Set, indexesToRemove)
|
|
81
|
+
local array = {}
|
|
82
|
+
__TS__ArrayForEach(
|
|
83
|
+
originalArray,
|
|
84
|
+
function(____, element, i)
|
|
85
|
+
if not indexesToRemoveSet:has(i) then
|
|
86
|
+
array[#array + 1] = element
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
)
|
|
90
|
+
return array
|
|
91
|
+
end
|
|
92
|
+
function ____exports.arrayRemoveIndexInPlace(self, array, ...)
|
|
93
|
+
local indexesToRemove = {...}
|
|
94
|
+
local legalIndexes = __TS__ArrayFilter(
|
|
95
|
+
indexesToRemove,
|
|
96
|
+
function(____, i) return i >= 0 and i < #array end
|
|
97
|
+
)
|
|
98
|
+
__TS__ArraySort(legalIndexes)
|
|
99
|
+
if #legalIndexes == 0 then
|
|
100
|
+
return false
|
|
101
|
+
end
|
|
102
|
+
do
|
|
103
|
+
local i = #array - 1
|
|
104
|
+
while i >= 0 do
|
|
105
|
+
__TS__ArraySplice(array, i, 1)
|
|
106
|
+
i = i - 1
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
return true
|
|
110
|
+
end
|
|
75
111
|
function ____exports.arrayToString(self, array)
|
|
76
112
|
if #array == 0 then
|
|
77
113
|
return "[]"
|
package/dist/maps/cardMap.lua
CHANGED
|
@@ -5,21 +5,27 @@ local ____exports = {}
|
|
|
5
5
|
____exports.CARD_MAP = __TS__New(Map, {
|
|
6
6
|
{"fool", 1},
|
|
7
7
|
{"magician", 2},
|
|
8
|
+
{"mag", 2},
|
|
8
9
|
{"highpriestess", 3},
|
|
9
10
|
{"priestess", 3},
|
|
11
|
+
{"priest", 3},
|
|
10
12
|
{"hp", 3},
|
|
11
13
|
{"empress", 4},
|
|
12
14
|
{"emperor", 5},
|
|
15
|
+
{"emp", 5},
|
|
13
16
|
{"hierophant", 6},
|
|
17
|
+
{"hi", 6},
|
|
14
18
|
{"lovers", 7},
|
|
15
19
|
{"chariot", 8},
|
|
16
20
|
{"justice", 9},
|
|
17
21
|
{"hermit", 10},
|
|
18
22
|
{"wheeloffortune", 11},
|
|
23
|
+
{"wheel", 11},
|
|
19
24
|
{"fortune", 11},
|
|
20
25
|
{"strength", 12},
|
|
21
|
-
{"
|
|
26
|
+
{"str", 12},
|
|
22
27
|
{"hangedman", 13},
|
|
28
|
+
{"hanged", 13},
|
|
23
29
|
{"death", 14},
|
|
24
30
|
{"temperance", 15},
|
|
25
31
|
{"devil", 16},
|
|
@@ -28,6 +34,7 @@ ____exports.CARD_MAP = __TS__New(Map, {
|
|
|
28
34
|
{"moon", 19},
|
|
29
35
|
{"sun", 20},
|
|
30
36
|
{"judgement", 21},
|
|
37
|
+
{"judge", 21},
|
|
31
38
|
{"world", 22},
|
|
32
39
|
{"2ofclubs", 23},
|
|
33
40
|
{"2clubs", 23},
|
|
@@ -94,6 +101,7 @@ ____exports.CARD_MAP = __TS__New(Map, {
|
|
|
94
101
|
{"mag?", 57},
|
|
95
102
|
{"highpriestess?", 58},
|
|
96
103
|
{"high?", 58},
|
|
104
|
+
{"hi?", 58},
|
|
97
105
|
{"priestess?", 58},
|
|
98
106
|
{"priest?", 58},
|
|
99
107
|
{"hp?", 58},
|