MCPcopy
hub / github.com/freeCodeCamp/freeCodeCamp / replacePrivateData

Function replacePrivateData

api/src/routes/public/user.ts:61–93  ·  view source on GitHub ↗
(user: RawUser)

Source from the content-addressed store, hash-verified

59 * @returns The shared user object.
60 */
61export const replacePrivateData = (user: RawUser) => {
62 const {
63 showAbout,
64 showHeatMap,
65 showCerts,
66 showDonation,
67 showLocation,
68 showName,
69 showPoints,
70 showPortfolio,
71 showExperience,
72 showTimeLine
73 } = user.profileUI;
74
75 return {
76 about: showAbout ? user.about : '',
77 calendar: showHeatMap ? user.calendar : {},
78 completedChallenges: showTimeLine
79 ? showCerts
80 ? user.completedChallenges
81 : user.completedChallenges.filter(
82 c => c.challengeType !== challengeTypes.step
83 )
84 : [],
85 isDonating: showDonation ? user.isDonating : null,
86 joinDate: showAbout ? user.joinDate : '',
87 location: showLocation ? user.location : '',
88 name: showName ? user.name : '',
89 points: showPoints ? user.points : null,
90 portfolio: showPortfolio ? user.portfolio : [],
91 experience: showExperience ? user.experience : []
92 };
93};
94
95const blockedUserAgentParts = ['python', 'google-apps-script', 'curl'];
96/**

Callers 2

userPublicGetRoutesFunction · 0.85
user.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected