Skip to content

Commit

Permalink
changed return type of ImageAssets#nextSource() to nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
yuko1101 committed Sep 12, 2024
1 parent b4112b3 commit e5f3d96
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 1.7.2
- Fixed image urls for AvatarRoundIcon.
- Changed return type of ImageAssets#nextSource() to nullable.
# 1.7.1
- Fixed structure errors with new excels (v2.4+).
- Improved code quality.
Expand Down
8 changes: 4 additions & 4 deletions src/models/assets/ImageAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class ImageAssets {

this.path = path;

this.imageBaseUrl = [...client.options.imageBaseUrls].filter(url => url.priority <= maxPriority).sort((a, b) => b.priority - a.priority).find(url => url.regexList.some(regex => regex.test(this.path))) ?? null;
this.imageBaseUrl = client.options.imageBaseUrls.filter(url => url.priority <= maxPriority).sort((a, b) => b.priority - a.priority).find(url => url.regexList.some(regex => regex.test(this.path))) ?? null;

this.url = (() => {
if (this.path === "" || this.imageBaseUrl == null) return "";
Expand All @@ -42,10 +42,10 @@ export class ImageAssets {
}

/**
* @returns a new instance of ImageAssets with the another imageBaseUrl, or this instance if the imageBaseUrl is null
* @returns a new instance of ImageAssets with the another imageBaseUrl
*/
nextSource(): ImageAssets {
if (this.imageBaseUrl == null) return this;
nextSource(): ImageAssets | null {
if (this.imageBaseUrl == null) return null;
return new ImageAssets(this.path, this.client, this.imageBaseUrl.priority - 1);
}
}
Expand Down

0 comments on commit e5f3d96

Please sign in to comment.