MCPcopy
hub / github.com/MisterBooo/LeetCodeAnimation / inject

Function inject

tools/scripts/build-readme.js:120–127  ·  view source on GitHub ↗
(content, target)

Source from the content-addressed store, hash-verified

118}
119
120function inject(content, target) {
121 const s = content.indexOf(target.start);
122 const e = content.indexOf(target.end);
123 if (s < 0 || e < 0 || e < s) {
124 throw new Error(`${path.relative(ROOT, target.file)} 缺少 ${target.start} / ${target.end} 标记,无法注入数字段`);
125 }
126 return content.slice(0, s + target.start.length) + "\n" + target.block() + "\n" + content.slice(e);
127}
128
129// 默认(无参):保持旧行为,打中文索引块到 stdout
130if (!write && !check) {

Callers 1

build-readme.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected