Open papsavas opened 2 months ago
Currently we're showcasing all github contributors including bots (i.e dependabot). We should filter them out
GitHub API returns a payload of Contributors Array containing a type value
type
"USER"
"BOT"
"ORGANIZATION"
Filter payload accordingly keeping only users
Following some generic strategies for filtering out object arrays:
// cleanest code, slowest const contributors = data .filter(contributor => contributor.type === "User") .map(contributor => ({ name: contributor.login }))
//fastest code, ugliest const contributors = data .reduce((acc, curr)=> { if(curr.type === "User") acc.push({ name: curr.login }); return acc; }, []);
//one liner, one iteration, faster than filter > map but slower than reduce const contributors = data .flatMap(contributor => contributor.type === "User" ? [{ name: contributor.login }] : [])
is this issue open?
Description
Currently we're showcasing all github contributors including bots (i.e dependabot). We should filter them out
Implementation
GitHub API returns a payload of Contributors Array containing a
type
value"USER"
"BOT"
"ORGANIZATION"
Filter payload accordingly keeping only users
Object Array Filtered Mapping
Following some generic strategies for filtering out object arrays: