isaacscript-common 28.4.0 → 28.5.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.
package/dist/index.rollup.d.ts
CHANGED
|
@@ -15132,6 +15132,15 @@ export declare function setFloorDisplayFlags(displayFlagsMap: Map<int, BitFlags<
|
|
|
15132
15132
|
*/
|
|
15133
15133
|
export declare function setGridEntityInvisible(gridEntity: GridEntity): void;
|
|
15134
15134
|
|
|
15135
|
+
/**
|
|
15136
|
+
* Helper function to check for one or more elements in a set at once without having to repeatedly
|
|
15137
|
+
* call the `Set.has` method.
|
|
15138
|
+
*
|
|
15139
|
+
* This function is variadic, meaning that you can pass as many things as you want to check for. It
|
|
15140
|
+
* will return true if one or more elements are found.
|
|
15141
|
+
*/
|
|
15142
|
+
export declare function setHas<T>(set: Set<T> | ReadonlySet<T>, ...elements: T[]): boolean;
|
|
15143
|
+
|
|
15135
15144
|
/**
|
|
15136
15145
|
* Helper function to make using sets with an type of `PlayerIndex` easier. Use this instead of the
|
|
15137
15146
|
* `Set.has` method if you have a set of this type.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 28.
|
|
3
|
+
isaacscript-common 28.5.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -28287,6 +28287,7 @@ local __TS__New = ____lualib.__TS__New
|
|
|
28287
28287
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
28288
28288
|
local __TS__Spread = ____lualib.__TS__Spread
|
|
28289
28289
|
local __TS__ArraySort = ____lualib.__TS__ArraySort
|
|
28290
|
+
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
28290
28291
|
local ____exports = {}
|
|
28291
28292
|
local ____ReadonlySet = require("src.types.ReadonlySet")
|
|
28292
28293
|
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
@@ -28368,6 +28369,13 @@ function ____exports.setAdd(self, set, ...)
|
|
|
28368
28369
|
set:add(element)
|
|
28369
28370
|
end
|
|
28370
28371
|
end
|
|
28372
|
+
function ____exports.setHas(self, set, ...)
|
|
28373
|
+
local elements = {...}
|
|
28374
|
+
return __TS__ArraySome(
|
|
28375
|
+
elements,
|
|
28376
|
+
function(____, element) return set:has(element) end
|
|
28377
|
+
)
|
|
28378
|
+
end
|
|
28371
28379
|
function ____exports.sumSet(self, set)
|
|
28372
28380
|
local values = {__TS__Spread(set:values())}
|
|
28373
28381
|
return sumArray(nil, values)
|
|
@@ -65,6 +65,14 @@ export declare function getSortedSetValues<T>(set: Set<T> | ReadonlySet<T>): T[]
|
|
|
65
65
|
* This function is variadic, meaning that you can pass as many things as you want to add.
|
|
66
66
|
*/
|
|
67
67
|
export declare function setAdd<T>(set: Set<T>, ...elements: T[]): void;
|
|
68
|
+
/**
|
|
69
|
+
* Helper function to check for one or more elements in a set at once without having to repeatedly
|
|
70
|
+
* call the `Set.has` method.
|
|
71
|
+
*
|
|
72
|
+
* This function is variadic, meaning that you can pass as many things as you want to check for. It
|
|
73
|
+
* will return true if one or more elements are found.
|
|
74
|
+
*/
|
|
75
|
+
export declare function setHas<T>(set: Set<T> | ReadonlySet<T>, ...elements: T[]): boolean;
|
|
68
76
|
/** Helper function to sum every value in a set together. */
|
|
69
77
|
export declare function sumSet(set: Set<number> | ReadonlySet<number>): number;
|
|
70
78
|
//# sourceMappingURL=set.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../src/functions/set.ts"],"names":[],"mappings":";;AAKA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EACf,GAAG,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,GAC3C,IAAI,CAMN;AAED;;;;GAIG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AED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EAC5B,iBAAiB,EAAE,OAAO,GACzB,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAK/B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAkBvE;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC,EAAE,GAAG,IAAI,CAI7D;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,CAAC,EACtB,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EAC5B,GAAG,QAAQ,EAAE,CAAC,EAAE,GACf,OAAO,CAET;AAED,4DAA4D;AAC5D,wBAAgB,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,CAGrE"}
|
|
@@ -5,6 +5,7 @@ local __TS__New = ____lualib.__TS__New
|
|
|
5
5
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
6
6
|
local __TS__Spread = ____lualib.__TS__Spread
|
|
7
7
|
local __TS__ArraySort = ____lualib.__TS__ArraySort
|
|
8
|
+
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
8
9
|
local ____exports = {}
|
|
9
10
|
local ____ReadonlySet = require("src.types.ReadonlySet")
|
|
10
11
|
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
@@ -129,6 +130,18 @@ function ____exports.setAdd(self, set, ...)
|
|
|
129
130
|
set:add(element)
|
|
130
131
|
end
|
|
131
132
|
end
|
|
133
|
+
--- Helper function to check for one or more elements in a set at once without having to repeatedly
|
|
134
|
+
-- call the `Set.has` method.
|
|
135
|
+
--
|
|
136
|
+
-- This function is variadic, meaning that you can pass as many things as you want to check for. It
|
|
137
|
+
-- will return true if one or more elements are found.
|
|
138
|
+
function ____exports.setHas(self, set, ...)
|
|
139
|
+
local elements = {...}
|
|
140
|
+
return __TS__ArraySome(
|
|
141
|
+
elements,
|
|
142
|
+
function(____, element) return set:has(element) end
|
|
143
|
+
)
|
|
144
|
+
end
|
|
132
145
|
--- Helper function to sum every value in a set together.
|
|
133
146
|
function ____exports.sumSet(self, set)
|
|
134
147
|
local values = {__TS__Spread(set:values())}
|
package/package.json
CHANGED
package/src/functions/set.ts
CHANGED
|
@@ -149,6 +149,20 @@ export function setAdd<T>(set: Set<T>, ...elements: T[]): void {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Helper function to check for one or more elements in a set at once without having to repeatedly
|
|
154
|
+
* call the `Set.has` method.
|
|
155
|
+
*
|
|
156
|
+
* This function is variadic, meaning that you can pass as many things as you want to check for. It
|
|
157
|
+
* will return true if one or more elements are found.
|
|
158
|
+
*/
|
|
159
|
+
export function setHas<T>(
|
|
160
|
+
set: Set<T> | ReadonlySet<T>,
|
|
161
|
+
...elements: T[]
|
|
162
|
+
): boolean {
|
|
163
|
+
return elements.some((element) => set.has(element));
|
|
164
|
+
}
|
|
165
|
+
|
|
152
166
|
/** Helper function to sum every value in a set together. */
|
|
153
167
|
export function sumSet(set: Set<number> | ReadonlySet<number>): number {
|
|
154
168
|
const values = [...set.values()];
|