I have an array similar to this
export const PRIVILEGES: privileges[] = [
{
Role: ['admin','trainer','trainee','designer'],
Home: true,
UserManagment: true,
DefineTraining:true,
AssignTraining: true ,
AssignedTraining: true,
PerformanceAnalysis: true
},
{
Role: ['admin','trainee'],
Home: true,
UserManagment: true,
DefineTraining:false,
AssignTraining: false ,
AssignedTraining: true,
PerformanceAnalysis: true
}]
and I have a Role defined as
Role=['admin','trainee']
"I want to get the object of PRIVILEGES where Role matches PRIVILEGES.Role"
I have tried
PRIVILEGES.find(x => x.Role == this.Role);
but this won't work because Role is an array and even though both x.Role and this.Role are same it returns a negative result.