Browse Source

Refactored minimizeFriends()

pull/28/head
Peter Morgan 5 years ago
parent
commit
2f394aefd6
1 changed files with 9 additions and 14 deletions
  1. +9
    -14
      routes/api/v2.js

+ 9
- 14
routes/api/v2.js View File

@ -114,23 +114,18 @@ function copyWithProperties(props, obj)
*
* @param {*} followingAndFollowers
*/
function minimizeFriends(people)
{
var friendLst = [];
var ids = new Set();
for(var i = 0; i < people.length; i++)
{
if(!ids.has(people[i].id))
{
ids.add(people[i].id);
const minimizeFriends = people => {
let friendLst = [];
let ids = new Set();
people.forEach(person => {
if(!ids.has(person.id)) {
ids.add(person.id);
friendLst.push({
login: people[i].login,
avatar_url: people[i].avatar_url
login: person.login,
avatar_url: person.avatar_url
});
}
}
});
return friendLst;
}

Loading…
Cancel
Save