MCPcopy Index your code
hub / github.com/visgl/deck.gl / processFile

Function processFile

scripts/write-heading-ids.ts:105–120  ·  view source on GitHub ↗

Process a md file. Rewrites the file content if custom ids are needed.

(path: string)

Source from the content-addressed store, hash-verified

103
104/** Process a md file. Rewrites the file content if custom ids are needed. */
105async function processFile(path: string): Promise<void> {
106 const context = await fs.readFile(path, {encoding: 'utf-8'});
107 let changed = false;
108 const lines = context.split('\n').map(line => {
109 const customId = getCustomId(line);
110 if (customId) {
111 changed = true;
112 return customId.join(' ');
113 }
114 return line;
115 });
116 if (changed) {
117 console.log(path);
118 await fs.writeFile(path, lines.join('\n'));
119 }
120}
121
122/** Recursively get all files within the given directory. */
123async function listFiles(path: string, extension: string): Promise<string[]> {

Callers 1

mainFunction · 0.85

Calls 1

getCustomIdFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…