chore: remove branching

This commit is contained in:
Randall Morey committed 2020-10-03 12:43:12 -04:00
1 parent 0bb884b19e
commit 5254cfe228
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'),
]
}
}