Social data

Find mutual accounts in exported relationship lists

Mutual accounts are present in both the followers and following lists. Compute an intersection rather than adding both lists together or treating either list alone as evidence of mutuality.

Worked example

Node.js example · save as example.mjs and run node example.mjs

const followers = new Set(["river", "sage", "taylor"]);
const following = new Set(["river", "taylor", "quinn"]);
const mutual = [...following].filter(name => followers.has(name));
console.log(JSON.stringify(mutual));

How it works

River and taylor are members of both sets. Each appears once even if the raw file repeats a username, because the sets represent unique identifiers. The direction of iteration controls display order but not membership of the intersection.

Limits and mistakes

The checker’s hidden-profile feature can remove some mutual accounts from the visible main list. Distinguish total set membership from a filtered display count. The supplied snapshots also need to represent the intended account and comparable export period.

Check the result

Expect ["river","taylor"]. Add a repeated username to one source list and verify it does not become a second unique mutual account.

Sources

Reference documentation for the behavior used in this guide: