generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: simpler enum and exhaustiveness check
- Loading branch information
Showing
5 changed files
with
27 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,8 @@ | ||
export default class UploadStrategy { | ||
private static readonly valuesArr: UploadStrategy[] = [] | ||
export type UploadStrategy = 'ANONYMOUS_IMGUR' | 'AUTHENTICATED_IMGUR' | ||
|
||
static get values(): ReadonlyArray<UploadStrategy> { | ||
return this.valuesArr | ||
} | ||
export type StrategyAndDescription = Record<UploadStrategy, string> | ||
|
||
static readonly ANONYMOUS_IMGUR = new UploadStrategy('ANONYMOUS_IMGUR', 'Anonymous Imgur upload') | ||
|
||
static readonly AUTHENTICATED_IMGUR = new UploadStrategy( | ||
'AUTHENTICATED_IMGUR', | ||
'Authenticated Imgur upload', | ||
) | ||
|
||
private constructor(readonly id: string, readonly description: string) { | ||
UploadStrategy.valuesArr.push(this) | ||
} | ||
export const UploadStrategies: StrategyAndDescription = { | ||
ANONYMOUS_IMGUR: 'Anonymous Imgur upload', | ||
AUTHENTICATED_IMGUR: 'Authenticated Imgur upload', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters