scats 1.0.32 → 1.0.33
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/package.json +1 -1
- package/src/collection.ts +4 -4
package/package.json
CHANGED
package/src/collection.ts
CHANGED
|
@@ -48,9 +48,9 @@ export class Collection<T> extends ArrayIterable<T, Collection<T>>
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
flatMap<B>(f: (item: T) => Collection<B>): Collection<B> {
|
|
51
|
-
|
|
51
|
+
const res: B[] = [];
|
|
52
52
|
this.items.forEach(i => {
|
|
53
|
-
res
|
|
53
|
+
res.push(...f(i).items);
|
|
54
54
|
});
|
|
55
55
|
return new Collection<B>(res);
|
|
56
56
|
}
|
|
@@ -106,10 +106,10 @@ export class Collection<T> extends ArrayIterable<T, Collection<T>>
|
|
|
106
106
|
* @param f
|
|
107
107
|
*/
|
|
108
108
|
async flatMapPromise<B>(f: (item: T) => Promise<Collection<B>>): Promise<Collection<B>> {
|
|
109
|
-
|
|
109
|
+
const res: B[] = [];
|
|
110
110
|
for (let i = 0; i < this.items.length; i++) {
|
|
111
111
|
const item = this.items[i];
|
|
112
|
-
res
|
|
112
|
+
res.push(...(await f(item)).items);
|
|
113
113
|
}
|
|
114
114
|
return new Collection<B>(res);
|
|
115
115
|
}
|