mirror of
https://github.com/lubosz/overte.git
synced 2025-04-16 15:30:11 +02:00
simpler filter code
This commit is contained in:
parent
5ece3f1e1a
commit
8aae2aa5f0
1 changed files with 5 additions and 4 deletions
|
@ -364,12 +364,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
function isOtherUsers(user) {
|
||||
return user.username != myUsername;
|
||||
}
|
||||
|
||||
function processData(data, type) {
|
||||
// Filter out yourself from the users list
|
||||
var removeIndex = data.users.map(function(user) { return user.username }).indexOf(myUsername);
|
||||
if (removeIndex >= 0) {
|
||||
data.users.splice(removeIndex,1);
|
||||
}
|
||||
data.users = data.users.filter(isOtherUsers);
|
||||
|
||||
// Sort array alphabetically by username
|
||||
data.users.sort(function(a, b) {
|
||||
|
|
Loading…
Reference in a new issue