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

Function collapse_ws

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

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

(s: &str)

Source from the content-addressed store, hash-verified

2246
2247/// `.replace(/\s+/g, ' ')` for the tuple-contract signature.
2248fn collapse_ws(s: &str) -> String {
2249 let mut out = String::with_capacity(s.len());
2250 let mut in_ws = false;
2251 for c in s.chars() {
2252 if c.is_whitespace() {
2253 if !in_ws {
2254 out.push(' ');
2255 in_ws = true;
2256 }
2257 } else {
2258 out.push(c);
2259 in_ws = false;
2260 }
2261 }
2262 out
2263}
2264
2265/// TS/JS wrappers that keep a member call's receiver the same object
2266/// (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