chore: remove branching
This commit is contained in:
1 file changed
+8
-10
@@ -1,19 +1,17 @@
|
||||
import Controller from '@ember/controller';
|
||||
import { sort } from '@ember/object/computed';
|
||||
|
||||
export default class ScopesScopeAuthenticateController extends Controller {
|
||||
// =attributes
|
||||
|
||||
/**
|
||||
* Moves the global scope to index 0.
|
||||
* @type {Array}
|
||||
*/
|
||||
@sort('model.scopes', (a, b) => {
|
||||
if (a.isGlobal) {
|
||||
return -1;
|
||||
} else if (b.isGlobal) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
sortedScopes;
|
||||
get sortedScopes() {
|
||||
return [
|
||||
...this.model.scopes.filter((scope) => scope.id === 'global'),
|
||||
...this.model.scopes.filter((scope) => scope.id !== 'global'),
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user