MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / withoutYamlComment

Function withoutYamlComment

src/resolution/frameworks/drupal.ts:324–334  ·  view source on GitHub ↗

Cut a trailing comment from a YAML line: the first `#` outside quotes after a space.

(line: string)

Source from the content-addressed store, hash-verified

322
323/** Cut a trailing comment from a YAML line: the first `#` outside quotes after a space. */
324function withoutYamlComment(line: string): string {
325 let quote = '';
326 for (let i = 0; i < line.length; i++) {
327 const c = line[i]!;
328 if (quote) {
329 if (c === quote) quote = '';
330 } else if (c === "'" || c === '"') quote = c;
331 else if (c === '#' && (i === 0 || /\s/.test(line[i - 1]!))) return line.slice(0, i);
332 }
333 return line;
334}
335
336/**
337 * Service definitions from a `*.services.yml` file. Line by line, as the routes are:

Callers 1

extractDrupalServicesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected