MCPcopy Index your code
hub / github.com/bufferhead-code/nextjs-use-php / findClosingBrace

Function findClosingBrace

build.ts:27–38  ·  view source on GitHub ↗
(string: String)

Source from the content-addressed store, hash-verified

25}
26
27function findClosingBrace(string: String) {
28 let codeBlocksCounter = 0;
29 let characterCounter = 0;
30 while (characterCounter < string.length) {
31 const ch = string[characterCounter];
32 if (ch === "{") codeBlocksCounter++;
33 else if (ch === "}") codeBlocksCounter--;
34 if (codeBlocksCounter == -1) return characterCounter;
35 characterCounter++;
36 }
37 return null;
38}
39
40function resetToOriginalState(filePath: string) {
41 const path = require('node:path');

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected