address comments

This commit is contained in:
Michael Zhu
2019-12-11 16:52:48 -08:00
parent 2f9891f0aa
commit 49538f272e
14 changed files with 151 additions and 159 deletions

View File

@@ -12,11 +12,12 @@ export function actorAddressesByName(actors: Actor[]): ObjectMap<string> {
}
/**
* Filters the given actors by class.
* Filters the given actors by role, specified by the class exported by an actor mixin file,
* e.g, 'Maker', 'Taker', etc.
*/
export function filterActorsByRole<TClass extends Constructor>(
actors: Actor[],
role: TClass,
): Array<InstanceType<typeof role>> {
return actors.filter(actor => actor instanceof role) as InstanceType<typeof role>;
return actors.filter(actor => actor.mixins.includes(role.name)) as InstanceType<typeof role>;
}