MCPcopy Create free account
hub / github.com/FIND-Lab/AgentWard / normalizeText

Function normalizeText

layers/foundation-scan.ts:135–155  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

133} | null | undefined;
134
135function normalizeText(input: string): string {
136 let normalized = "";
137 for (const ch of input) {
138 const codePoint = ch.charCodeAt(0);
139 if (codePoint === 0x3000) {
140 normalized += " ";
141 continue;
142 }
143 if (codePoint >= 0xff01 && codePoint <= 0xff5e) {
144 normalized += String.fromCharCode(codePoint - 0xfee0);
145 continue;
146 }
147 normalized += ch;
148 }
149
150 return normalized
151 .replace(/[\u200B-\u200D\uFEFF]/g, "")
152 .toLowerCase()
153 .replace(/\s+/g, " ")
154 .trim();
155}
156
157function isLikelyTextFile(filePath: string): boolean {
158 const ext = path.extname(filePath).toLowerCase();

Callers 1

detectByRulesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected