MCPcopy
hub / github.com/payloadcms/payload / parseExample

Function parseExample

packages/create-payload-app/src/lib/examples.ts:20–38  ·  view source on GitHub ↗
({
  name,
  branch,
}: {
  branch: string
  name: string
})

Source from the content-addressed store, hash-verified

18}
19
20export async function parseExample({
21 name,
22 branch,
23}: {
24 branch: string
25 name: string
26}): Promise<false | ProjectExample> {
27 const examples = await getExamples({ branch })
28
29 const example = examples.find((e) => e.name === name)
30
31 if (!example) {
32 error(`'${name}' is not a valid example name.`)
33 info(`Valid examples: ${examples.map((e) => e.name).join(', ')}`)
34 return false
35 }
36
37 return example
38}

Callers 1

initMethod · 0.85

Calls 4

getExamplesFunction · 0.85
errorFunction · 0.85
infoFunction · 0.50
findMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…