isaacscript-common 42.0.0 → 43.0.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
|
@@ -1112,14 +1112,13 @@ export declare function arrayRemoveIndex<T>(originalArray: T[] | readonly T[], .
|
|
|
1112
1112
|
|
|
1113
1113
|
/**
|
|
1114
1114
|
* Removes the elements at the specified indexes from the array. If the specified indexes are not
|
|
1115
|
-
* found in the array, this function will do nothing.
|
|
1116
|
-
* removed.
|
|
1115
|
+
* found in the array, this function will do nothing.
|
|
1117
1116
|
*
|
|
1118
1117
|
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
1119
1118
|
*
|
|
1120
|
-
* @returns
|
|
1119
|
+
* @returns The removed elements. This will be an empty array if no elements were removed.
|
|
1121
1120
|
*/
|
|
1122
|
-
export declare function arrayRemoveIndexInPlace<T>(array: T[], ...indexesToRemove: int[]):
|
|
1121
|
+
export declare function arrayRemoveIndexInPlace<T>(array: T[], ...indexesToRemove: int[]): T[];
|
|
1123
1122
|
|
|
1124
1123
|
/**
|
|
1125
1124
|
* Removes the specified element(s) from the array. If the specified element(s) are not found in the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common
|
|
3
|
+
isaacscript-common 43.0.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -17031,16 +17031,18 @@ function ____exports.arrayRemoveIndexInPlace(self, array, ...)
|
|
|
17031
17031
|
)
|
|
17032
17032
|
__TS__ArraySort(legalIndexes)
|
|
17033
17033
|
if #legalIndexes == 0 then
|
|
17034
|
-
return
|
|
17034
|
+
return {}
|
|
17035
17035
|
end
|
|
17036
|
+
local removedElements = {}
|
|
17036
17037
|
do
|
|
17037
17038
|
local i = #array - 1
|
|
17038
17039
|
while i >= 0 do
|
|
17039
|
-
__TS__ArraySplice(array, i, 1)
|
|
17040
|
+
local removedElement = __TS__ArraySplice(array, i, 1)
|
|
17041
|
+
__TS__ArrayPushArray(removedElements, removedElement)
|
|
17040
17042
|
i = i - 1
|
|
17041
17043
|
end
|
|
17042
17044
|
end
|
|
17043
|
-
return
|
|
17045
|
+
return removedElements
|
|
17044
17046
|
end
|
|
17045
17047
|
function ____exports.arrayToString(self, array)
|
|
17046
17048
|
if #array == 0 then
|
|
@@ -66,14 +66,13 @@ export declare function arrayRemoveInPlace<T>(array: T[], ...elementsToRemove: T
|
|
|
66
66
|
export declare function arrayRemoveIndex<T>(originalArray: T[] | readonly T[], ...indexesToRemove: int[]): T[];
|
|
67
67
|
/**
|
|
68
68
|
* Removes the elements at the specified indexes from the array. If the specified indexes are not
|
|
69
|
-
* found in the array, this function will do nothing.
|
|
70
|
-
* removed.
|
|
69
|
+
* found in the array, this function will do nothing.
|
|
71
70
|
*
|
|
72
71
|
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
73
72
|
*
|
|
74
|
-
* @returns
|
|
73
|
+
* @returns The removed elements. This will be an empty array if no elements were removed.
|
|
75
74
|
*/
|
|
76
|
-
export declare function arrayRemoveIndexInPlace<T>(array: T[], ...indexesToRemove: int[]):
|
|
75
|
+
export declare function arrayRemoveIndexInPlace<T>(array: T[], ...indexesToRemove: int[]): T[];
|
|
77
76
|
export declare function arrayToString(array: unknown[]): string;
|
|
78
77
|
/**
|
|
79
78
|
* Helper function to combine two or more arrays. Returns a new array that is the composition of all
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src/functions/array.ts"],"names":[],"mappings":";;;AAMA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,MAAM,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,EAC1B,MAAM,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,GACzB,OAAO,CAST;AAED;;;;;;;;;;GAUG;AAC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AG,IAAI,CAM3E"}
|
|
@@ -237,12 +237,11 @@ function ____exports.arrayRemoveIndex(self, originalArray, ...)
|
|
|
237
237
|
return array
|
|
238
238
|
end
|
|
239
239
|
--- Removes the elements at the specified indexes from the array. If the specified indexes are not
|
|
240
|
-
-- found in the array, this function will do nothing.
|
|
241
|
-
-- removed.
|
|
240
|
+
-- found in the array, this function will do nothing.
|
|
242
241
|
--
|
|
243
242
|
-- This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
244
243
|
--
|
|
245
|
-
-- @returns
|
|
244
|
+
-- @returns The removed elements. This will be an empty array if no elements were removed.
|
|
246
245
|
function ____exports.arrayRemoveIndexInPlace(self, array, ...)
|
|
247
246
|
local indexesToRemove = {...}
|
|
248
247
|
local legalIndexes = __TS__ArrayFilter(
|
|
@@ -251,16 +250,18 @@ function ____exports.arrayRemoveIndexInPlace(self, array, ...)
|
|
|
251
250
|
)
|
|
252
251
|
__TS__ArraySort(legalIndexes)
|
|
253
252
|
if #legalIndexes == 0 then
|
|
254
|
-
return
|
|
253
|
+
return {}
|
|
255
254
|
end
|
|
255
|
+
local removedElements = {}
|
|
256
256
|
do
|
|
257
257
|
local i = #array - 1
|
|
258
258
|
while i >= 0 do
|
|
259
|
-
__TS__ArraySplice(array, i, 1)
|
|
259
|
+
local removedElement = __TS__ArraySplice(array, i, 1)
|
|
260
|
+
__TS__ArrayPushArray(removedElements, removedElement)
|
|
260
261
|
i = i - 1
|
|
261
262
|
end
|
|
262
263
|
end
|
|
263
|
-
return
|
|
264
|
+
return removedElements
|
|
264
265
|
end
|
|
265
266
|
function ____exports.arrayToString(self, array)
|
|
266
267
|
if #array == 0 then
|
package/package.json
CHANGED
package/src/functions/array.ts
CHANGED
|
@@ -147,31 +147,33 @@ export function arrayRemoveIndex<T>(
|
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
149
|
* Removes the elements at the specified indexes from the array. If the specified indexes are not
|
|
150
|
-
* found in the array, this function will do nothing.
|
|
151
|
-
* removed.
|
|
150
|
+
* found in the array, this function will do nothing.
|
|
152
151
|
*
|
|
153
152
|
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
154
153
|
*
|
|
155
|
-
* @returns
|
|
154
|
+
* @returns The removed elements. This will be an empty array if no elements were removed.
|
|
156
155
|
*/
|
|
157
156
|
export function arrayRemoveIndexInPlace<T>(
|
|
158
157
|
array: T[],
|
|
159
158
|
...indexesToRemove: int[]
|
|
160
|
-
):
|
|
159
|
+
): T[] {
|
|
161
160
|
const legalIndexes = indexesToRemove.filter(
|
|
162
161
|
(i) => i >= 0 && i < array.length,
|
|
163
162
|
);
|
|
164
163
|
legalIndexes.sort();
|
|
165
164
|
|
|
166
165
|
if (legalIndexes.length === 0) {
|
|
167
|
-
return
|
|
166
|
+
return [];
|
|
168
167
|
}
|
|
169
168
|
|
|
169
|
+
const removedElements: T[] = [];
|
|
170
|
+
|
|
170
171
|
for (let i = array.length - 1; i >= 0; i--) {
|
|
171
|
-
array.splice(i, 1);
|
|
172
|
+
const removedElement = array.splice(i, 1);
|
|
173
|
+
removedElements.push(...removedElement);
|
|
172
174
|
}
|
|
173
175
|
|
|
174
|
-
return
|
|
176
|
+
return removedElements;
|
|
175
177
|
}
|
|
176
178
|
|
|
177
179
|
export function arrayToString(array: unknown[]): string {
|