@laplace.live/internal 1.3.46 → 1.3.47
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 +1 -1
- package/src/const/guilds.ts +18 -0
package/package.json
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Renamed Bilibili live guilds, former name → current name. Values must be current names, never another key. */
|
|
2
|
+
export const guildRenames: ReadonlyMap<string, string> = new Map([['萌鸽传媒', 'MoeLive']])
|
|
3
|
+
|
|
4
|
+
/** Current name of a guild, following renames. */
|
|
5
|
+
export function getNormalizedGuildName(name: string): string {
|
|
6
|
+
return guildRenames.get(name) ?? name
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Whether two guild names refer to the same guild once renames are followed. */
|
|
10
|
+
export function isSameGuild(a: string, b: string): boolean {
|
|
11
|
+
return getNormalizedGuildName(a) === getNormalizedGuildName(b)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Every name a guild has gone by, current name first. */
|
|
15
|
+
export function getGuildNameVariants(name: string): string[] {
|
|
16
|
+
const current = getNormalizedGuildName(name)
|
|
17
|
+
return [current, ...[...guildRenames].filter(([, to]) => to === current).map(([from]) => from)]
|
|
18
|
+
}
|