Files: ca718f616a051e93adeb22faa3fc06646f667973 / graph / helpers / build-links.js
491 bytesRaw
1 | const { keys } = Object |
2 | |
3 | module.exports = buildLinks |
4 | |
5 | function buildLinks (friends) { |
6 | return keys(friends).reduce((sofar, friend) => { |
7 | const friendOfFriends = keys(friends[friend]) |
8 | .filter(id => friends[friend][id] === true) |
9 | |
10 | const edges = friendOfFriends.map(friendOfFriend => { |
11 | return { |
12 | fromId: friend, |
13 | toId: friendOfFriend, |
14 | data: { |
15 | hidden: true |
16 | } |
17 | } |
18 | }) |
19 | |
20 | return [ |
21 | ...sofar, |
22 | ...edges |
23 | ] |
24 | }, []) |
25 | } |
26 |
Built with git-ssb-web