MCPcopy
hub / github.com/primer/react / handleCallback

Function handleCallback

script/component-status-project/build.ts:24–44  ·  view source on GitHub ↗
(
    filename: string,
    resolve: (value: ComponentStatus | null) => void,
    reject: (value: unknown) => void,
  )

Source from the content-addressed store, hash-verified

22 const promises: Promise<ComponentStatus | null>[] = []
23
24 const handleCallback = (
25 filename: string,
26 resolve: (value: ComponentStatus | null) => void,
27 reject: (value: unknown) => void,
28 ) => {
29 fs.readFile(path.resolve(dir, filename), 'utf-8', (err, content) => {
30 if (err) return reject(err)
31
32 if (fm.test(content)) {
33 const {
34 attributes: {title, status},
35 } = fm(content)
36
37 if (status) {
38 return resolve({[title]: status})
39 }
40 }
41
42 resolve(null)
43 })
44 }
45
46 for (const filename of filenames) {
47 const promise: Promise<ComponentStatus | null> = new Promise((resolve, reject) => {

Callers 1

getComponentStatusesFunction · 0.85

Calls 1

resolveFunction · 0.85

Tested by

no test coverage detected