Skip to content

Commit 7087d34

Browse files
feat(ClanWar): add getMemberByMapPosition (#189)
* feat(ClanWar): add getMemberByMapPosition Add method to ClanWar to provide encapsulated functionality for getting a member by their map position in war. * chore: bump package version to 3.3.11 * Update package.json --------- Co-authored-by: Suvajit <[email protected]>
1 parent a96b9d2 commit 7087d34

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@
7373
"engines": {
7474
"node": ">=16.x"
7575
}
76-
}
76+
}

src/struct/ClanWar.ts

+5
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ export class WarClan {
225225
return this.members.find((m) => m.tag === tag) ?? null;
226226
}
227227

228+
/** Get a member of the clan for the given map position, or `null` if not found. */
229+
public getMemberByMapPosition(mapPosition: number): ClanWarMember | null {
230+
return this.members.find((m) => m.mapPosition === mapPosition) ?? null;
231+
}
232+
228233
/** Get clan's formatted link to open clan in-game. */
229234
public get shareLink() {
230235
return `https://link.clashofclans.com/en?action=OpenClanProfile&tag=${this.tag.replace(/#/g, '')}`;

0 commit comments

Comments
 (0)