MCPcopy
hub / github.com/sansan0/TrendRadar / findChildKey

Function findChildKey

docs/assets/script.js:4716–4729  ·  view source on GitHub ↗

* 查找子级 key 行

(lines, start, end, parentIndent, key)

Source from the content-addressed store, hash-verified

4714 * 查找子级 key 行
4715 */
4716function findChildKey(lines, start, end, parentIndent, key) {
4717 for (let i = start + 1; i < end; i++) {
4718 const line = lines[i];
4719 if (line.trim() === '' || line.trim().startsWith('#')) continue;
4720 const indent = line.search(/\S/);
4721 if (indent <= parentIndent) break;
4722 const m = line.match(/^\s*(\S+):\s*/);
4723 const rawKey = m ? m[1].replace(/^["']|["']$/g, '') : null;
4724 if (m && rawKey === key && indent === parentIndent + 2) {
4725 return i;
4726 }
4727 }
4728 return -1;
4729}
4730
4731/**
4732 * 找一个 block 的结束行号(下一个同级或更低缩进的非空非注释行)

Callers 10

script.jsFile · 0.85
updateTimelineFieldFunction · 0.85
resolveTimelineTargetFunction · 0.85
removeTimelineFieldFunction · 0.85
insertTimelineFieldFunction · 0.85
removePeriodFromDayPlansFunction · 0.85
updatePresetMetaFunction · 0.85
reorderDayPlanPeriodsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected