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

Function withoutYamlComment

src/resolution/frameworks/drupal.ts:325–335  ·  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

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