s2cfgtojson 3.2.1 → 3.2.3
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/Struct.mts +10 -8
- package/Struct.test.mts +3 -1
- package/package.json +1 -1
- package/types.mts +1 -1
package/Struct.mts
CHANGED
|
@@ -102,9 +102,11 @@ export class Struct {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
forEach<K extends Exclude<keyof this, Internal>, V extends (typeof this)[K]>(
|
|
105
|
-
callback: ([key, value]: [K, V]) => void,
|
|
105
|
+
callback: ([key, value]: [K, V], i: number, arr: [K, V][]) => void,
|
|
106
106
|
): void {
|
|
107
|
-
this.entries().forEach(([key, value]
|
|
107
|
+
this.entries().forEach(([key, value], i, arr) =>
|
|
108
|
+
callback([key as K, value as V], i, arr as any),
|
|
109
|
+
);
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
/**
|
|
@@ -112,11 +114,11 @@ export class Struct {
|
|
|
112
114
|
* @param callback
|
|
113
115
|
*/
|
|
114
116
|
filter<K extends Exclude<keyof this, Internal>, V extends (typeof this)[K]>(
|
|
115
|
-
callback: ([key, value]: [K, V]) => boolean,
|
|
117
|
+
callback: ([key, value]: [K, V], i: number, arr: [K, V][]) => boolean,
|
|
116
118
|
): Partial<this> & Struct {
|
|
117
119
|
const clone = this.clone();
|
|
118
|
-
clone.entries().forEach(([key, value]) => {
|
|
119
|
-
if (!callback([key as K, value as V])) {
|
|
120
|
+
clone.entries().forEach(([key, value], i, arr) => {
|
|
121
|
+
if (!callback([key as K, value as V], i, arr as any)) {
|
|
120
122
|
delete clone[key];
|
|
121
123
|
}
|
|
122
124
|
});
|
|
@@ -128,11 +130,11 @@ export class Struct {
|
|
|
128
130
|
* @param callback
|
|
129
131
|
*/
|
|
130
132
|
map<K extends Exclude<keyof this, Internal>, V extends (typeof this)[K]>(
|
|
131
|
-
callback: ([key, value]: [K, V]) => V,
|
|
133
|
+
callback: ([key, value]: [K, V], i: number, arr: [K, V][]) => V,
|
|
132
134
|
): this {
|
|
133
135
|
const clone = this.clone();
|
|
134
|
-
clone.entries().forEach(([key, value]) => {
|
|
135
|
-
clone[key] = callback([key as K, value as V]);
|
|
136
|
+
clone.entries().forEach(([key, value], i, arr) => {
|
|
137
|
+
clone[key] = callback([key as K, value as V], i, arr as any);
|
|
136
138
|
});
|
|
137
139
|
return clone;
|
|
138
140
|
}
|
package/Struct.test.mts
CHANGED
|
@@ -318,4 +318,6 @@ struct.end`;
|
|
|
318
318
|
// noinspection JSUnusedLocalSymbols
|
|
319
319
|
const MyRank: ERank = "ERank::Experienced, ERank::Veteran, ERank::Master";
|
|
320
320
|
// noinspection BadExpressionStatementJS
|
|
321
|
-
(({}) as ArmorPrototype).
|
|
321
|
+
(({}) as ArmorPrototype["MeshGenerator"]).forEach(([_k, e]) => {
|
|
322
|
+
e.Cost *= 2;
|
|
323
|
+
});
|
package/package.json
CHANGED
package/types.mts
CHANGED
|
@@ -107,7 +107,7 @@ export interface DefaultEntries {
|
|
|
107
107
|
|
|
108
108
|
export type GetStructType<In> =
|
|
109
109
|
In extends Array<any>
|
|
110
|
-
? Struct & { [key
|
|
110
|
+
? Struct & { [key: `${number}`]: GetStructType<In[typeof key]> }
|
|
111
111
|
: In extends Record<any, any>
|
|
112
112
|
? Struct & { [key in keyof In]: GetStructType<In[key]> }
|
|
113
113
|
: In extends string
|