MCPcopy Create free account
hub / github.com/freeCodeCamp/freeCodeCamp / setContent

Function setContent

packages/shared/src/utils/polyvinyl.ts:89–100  ·  view source on GitHub ↗
(
  contents: string,
  poly: ChallengeFile,
  source?: string
)

Source from the content-addressed store, hash-verified

87
88// setContent will lose source if not supplied
89export function setContent(
90 contents: string,
91 poly: ChallengeFile,
92 source?: string
93): ChallengeFile {
94 checkPoly(poly);
95 return {
96 ...poly,
97 contents,
98 source
99 };
100}
101
102// This is currently only used to add back properties that are not stored in the
103// database.

Callers 2

legacyToFileFunction · 0.90
transformContentsFunction · 0.85

Calls 1

checkPolyFunction · 0.85

Tested by

no test coverage detected