MCPcopy Create free account
hub / github.com/TruthHun/BookStack / findOpening

Function findOpening

static/editor.md/lib/codemirror/addon/fold/brace-fold.js:18–32  ·  view source on GitHub ↗
(openCh)

Source from the content-addressed store, hash-verified

16 var startCh, tokenType;
17
18 function findOpening(openCh) {
19 for (var at = start.ch, pass = 0;;) {
20 var found = at <= 0 ? -1 : lineText.lastIndexOf(openCh, at - 1);
21 if (found == -1) {
22 if (pass == 1) break;
23 pass = 1;
24 at = lineText.length;
25 continue;
26 }
27 if (pass == 1 && found < start.ch) break;
28 tokenType = cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1));
29 if (!/^(comment|string)/.test(tokenType)) return found + 1;
30 at = found - 1;
31 }
32 }
33
34 var startToken = "{", endToken = "}", startCh = findOpening("{");
35 if (startCh == null) {

Callers 1

brace-fold.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected