1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-23 17:02:25 +03:00

Add a property aggregating all names of a NamespacedValue (#2656)

For convenience
This commit is contained in:
Robin
2022-09-09 09:55:17 -04:00
committed by GitHub
parent 1b86acb2fb
commit b22c671fee
2 changed files with 12 additions and 0 deletions

View File

@@ -41,6 +41,13 @@ export class NamespacedValue<S extends string, U extends string> {
return this.unstable;
}
public get names(): (U | S)[] {
const names = [this.name];
const altName = this.altName;
if (altName) names.push(altName);
return names;
}
public matches(val: string): boolean {
return this.name === val || this.altName === val;
}