MCPcopy Create free account
hub / github.com/Qinbf/groundmap / mask_js_comments

Function mask_js_comments

scripts/k.py:166–170  ·  view source on GitHub ↗

把 JS/TS 注释(// 单行 + /* */ 多行)替换为等长空白,保留偏移与行号。

(text: str)

Source from the content-addressed store, hash-verified

164
165
166def mask_js_comments(text: str) -> str:
167 """把 JS/TS 注释(// 单行 + /* */ 多行)替换为等长空白,保留偏移与行号。"""
168 def _blank(m: re.Match) -> str:
169 return "".join("\n" if ch == "\n" else " " for ch in m.group(0))
170 return JS_COMMENT_RE.sub(_blank, text)
171
172
173# JSX 表达式容器 {…}(最内层无嵌套花括号、且不跨行的一段),用于在扫 JSX 文本时剥除。

Callers 1

list_i18n_violationsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected