I have the following function:
const role: string = tokenPayload.params.role.map(r => {
  return r.value;
}) [0];
It returns the following result:
author
If I remove the index [0], it returns this:
["author", "admin"]
Is it possible for the function to return all values in the same format as the first exemple?
The const "role" will be used in a comparison === that only accepts result in that specific format. I will put the full function for better understanding:
canActivateChild(route: ActivatedRouteSnapshot): boolean {
    const helper = new JwtHelperService();
    const expectedRole = route.data.expectedRole;
    const token = this.authService.getToken();
    const tokenPayload = helper.decodeToken(token);
    const role: string = tokenPayload.params.role.map(r => {
  return r.value;
}) [0];
console.log(role);
if (!this.authService.isAuthenticated() || role !== expectedRole) {
  this.router.navigate(['/admin']);
  return false;
}
return true;
}
router component:
{
    path: 'container-users',
    component: ContainerUsersComponent,
    canActivateChild: [AuthGuard],
    data: {
      expectedRole: 'admin'
    },
    children: [
      { path: '', component: ListUsersComponent },
      { path: 'list-users', component: ListUsersComponent },
      { path: 'form-new-user', component: FormNewUserComponent }
    ]
  }
 
     
    