class BasePlayer {
}
class PlayerWithRole extends BasePlayer {
constructor(properties) {
super(properties);
}
}
let playerFactory = function (role, properties) {
let roles = {
someRole: PlayerWithRole
}
return new roles[role](properties);
}