objectKeyName (tree-sitter.ts): strip ONE leading and ONE trailing quote character (`'`, `"`, or backtick).
(s: &str)
| 182 | /// objectKeyName (tree-sitter.ts): strip ONE leading and ONE trailing quote |
| 183 | /// character (`'`, `"`, or backtick). |
| 184 | pub fn object_key_name(s: &str) -> String { |
| 185 | let mut out = s; |
| 186 | if let Some(first) = out.chars().next() { |
| 187 | if first == '\'' || first == '"' || first == '`' { |
| 188 | out = &out[first.len_utf8()..]; |
| 189 | } |
| 190 | } |
| 191 | if let Some(last) = out.chars().last() { |
| 192 | if last == '\'' || last == '"' || last == '`' { |
| 193 | out = &out[..out.len() - last.len_utf8()]; |
| 194 | } |
| 195 | } |
| 196 | out.to_string() |
| 197 | } |
| 198 | |
| 199 | /// The `= <first 100 UTF-16 units>[...]` initializer signature used by |
| 200 | /// extractVariable (its `.length >= 100` check fires exactly when the slice |
no test coverage detected