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

Function collapse_ws

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

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

(s: &str)

Source from the content-addressed store, hash-verified

2116
2117/// `.replace(/\s+/g, ' ')` for the tuple-contract signature.
2118fn collapse_ws(s: &str) -> String {
2119 let mut out = String::with_capacity(s.len());
2120 let mut in_ws = false;
2121 for c in s.chars() {
2122 if c.is_whitespace() {
2123 if !in_ws {
2124 out.push(' ');
2125 in_ws = true;
2126 }
2127 } else {
2128 out.push(c);
2129 in_ws = false;
2130 }
2131 }
2132 out
2133}
2134
2135/// TS/JS wrappers that keep a member call's receiver the same object
2136/// (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