MCPcopy Create free account
hub / github.com/github/docs / checkReusable

Function checkReusable

script/early-access/update-data-and-image-paths.js:152–165  ·  view source on GitHub ↗
(dataRef)

Source from the content-addressed store, hash-verified

150}
151
152function checkReusable(dataRef) {
153 // Get the data filepath from the data reference,
154 // where the data reference looks like: {% data reusables.foo.bar %}
155 // and the data filepath looks like: data/reusables/foo/bar.md.
156 const reusablePath = dataRef
157 .match(/{% data (.*?) %}/)[1]
158 .split('.')
159 // If early access is part of the path, remove it (since the path below already includes it)
160 .filter((n) => n !== 'early-access')
161 .join('/')
162
163 // If the reusable file doesn't exist in data/early-access, exclude it
164 return fs.existsSync(`${path.posix.join(earlyAccessData, reusablePath)}.md`)
165}
166
167function checkImage(imageRef) {
168 const imagePath = imageRef

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected