You've already forked matrix-js-sdk
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user