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

Function collapse_ws

codegraph-kernel/src/tsjs/extractors.rs:2256–2271  ·  view source on GitHub ↗

`.replace(/\s+/g, ' ')` for the tuple-contract signature.

(s: &str)

Source from the content-addressed store, hash-verified

2254
2255/// `.replace(/\s+/g, ' ')` for the tuple-contract signature.
2256fn collapse_ws(s: &str) -> String {
2257 let mut out = String::with_capacity(s.len());
2258 let mut in_ws = false;
2259 for c in s.chars() {
2260 if c.is_whitespace() {
2261 if !in_ws {
2262 out.push(' ');
2263 in_ws = true;
2264 }
2265 } else {
2266 out.push(c);
2267 in_ws = false;
2268 }
2269 }
2270 out
2271}
2272
2273/// TS/JS wrappers that keep a member call's receiver the same object
2274/// (mirrors TS_JS_TRANSPARENT_RECEIVER_TYPES in tree-sitter.ts).

Callers 1

Calls 2

lenMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected