`.replace(/\s+/g, ' ')` for the tuple-contract signature.
(s: &str)
| 2116 | |
| 2117 | /// `.replace(/\s+/g, ' ')` for the tuple-contract signature. |
| 2118 | fn 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). |
no test coverage detected