Home > database >  How to simplify statement
How to simplify statement

Time:06-21

How to simplify statement? Admin can have unlimited count users

public get isUsersLimitReached(): boolean {
  return this.isAdmin ? false : usersCount >= this.max_users;
}

CodePudding user response:

If by "simplify", you mean "shorten", then this is as good as it gets:

public get isUsersLimitReached(): boolean {
  return !this.isAdmin && usersCount >= this.max_users;
}

Other than that, there's really not much to work with here.

CodePudding user response:

A user limit is reached only if the user is not admin and count exceeds.

public get isUsersLimitReached(): boolean {
  return !this.isAdmin && usersCount >= this.max_users;
}
  • Related