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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scats",
3
- "version": "1.0.32",
3
+ "version": "1.0.33",
4
4
  "description": "Useful scala classes in typescript",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
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
- let res: B[] = [];
51
+ const res: B[] = [];
52
52
  this.items.forEach(i => {
53
- res = res.concat(f(i).items);
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
- let res: B[] = [];
109
+ const res: B[] = [];
110
110
  for (let i = 0; i < this.items.length; i++) {
111
111
  const item = this.items[i];
112
- res = res.concat((await f(item)).items);
112
+ res.push(...(await f(item)).items);
113
113
  }
114
114
  return new Collection<B>(res);
115
115
  }