s2cfgtojson 3.2.9 → 3.2.10

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.
Files changed (2) hide show
  1. package/Struct.mts +11 -7
  2. package/package.json +1 -1
package/Struct.mts CHANGED
@@ -122,16 +122,20 @@ export class Struct {
122
122
  * Filters the struct entries based on a callback function. Returns a copy.
123
123
  * @param callback
124
124
  */
125
- filter<K extends Exclude<keyof this, Internal>, V extends (typeof this)[K]>(
126
- callback: ([key, value]: [K, V], i: number, arr: [K, V][]) => boolean,
127
- ): Partial<this> & Struct {
125
+ filter<
126
+ K extends Exclude<keyof this, Internal>,
127
+ V extends (typeof this)[K],
128
+ S extends [K, V],
129
+ >(
130
+ callback: (value: [K, V], index: number, array: [K, V][]) => value is S,
131
+ ): Record<K, V> & Struct {
128
132
  const clone = this.clone();
129
- clone.entries().forEach(([key, value], i, arr) => {
130
- if (!callback([key as K, value as V], i, arr as any)) {
131
- delete clone[key];
133
+ clone.entries().forEach((entry, i, arr) => {
134
+ if (!callback(entry as any, i, arr as any)) {
135
+ delete clone[entry[0]];
132
136
  }
133
137
  });
134
- return clone;
138
+ return clone as any;
135
139
  }
136
140
 
137
141
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "s2cfgtojson",
3
- "version": "3.2.9",
3
+ "version": "3.2.10",
4
4
  "description": "Converts Stalker 2 Cfg file into POJOs",
5
5
  "keywords": [
6
6
  "stalker",