Check out the code snippet below:
let data.roles = "Admin:Xxxx:Data";
for (let role of data.roles.split(':')) {
user.data.role[`is${role}`] = true;
}
Is there a way to optimize this code to dynamically create role properties for any role present in data.roles without the need for individual if checks?