Reputation: 35
My condition is working, but i believe there is a more elegant and short way to write it:
if (this.filters.provider.length !== 1) {
return true
} else {
if (this.filters.provider.includes('test')) { return false }
return true
}
Upvotes: 2
Views: 82
Reputation: 1
you can use a ternary operator like this:
return (this.filters.provider.length !== 1) ? true : this.filters.provider.includes('test') ? false : true;
Upvotes: 0
Reputation: 14512
return this.filters.provider.length !== 1 || !this.filters.provider.includes('test');
Upvotes: 2