Skip to content

Commit

Permalink
Rename field
Browse files Browse the repository at this point in the history
It is more important to highlight that the field has a different type
than that the field too contains promises.
  • Loading branch information
WULCAN committed Aug 18, 2024
1 parent e5486f7 commit 034bc7e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions webapp/src/utils/Promises.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export class Promises<T> {
private constructor(private promises: Array<Promise<T>>) {}
private constructor(private array: Array<Promise<T>>) {}

static of<T>(array: Array<Promise<T>>) {
return new Promises(array);
}

map<U>(callbackFn: (value: T) => U | Promise<U>): Promises<U> {
return new Promises(this.promises.map((p) => p.then(callbackFn)));
return new Promises(this.array.map((p) => p.then(callbackFn)));
}

all() {
return Promise.all(this.promises);
return Promise.all(this.array);
}
}

0 comments on commit 034bc7e

Please sign in to comment.