objectKeyName (tree-sitter.ts): strip ONE leading and ONE trailing quote character (`'`, `"`, or backtick).
(s: &str)
| 226 | /// objectKeyName (tree-sitter.ts): strip ONE leading and ONE trailing quote |
| 227 | /// character (`'`, `"`, or backtick). |
| 228 | pub fn object_key_name(s: &str) -> String { |
| 229 | let mut out = s; |
| 230 | if let Some(first) = out.chars().next() { |
| 231 | if first == '\'' || first == '"' || first == '`' { |
| 232 | out = &out[first.len_utf8()..]; |
| 233 | } |
| 234 | } |
| 235 | if let Some(last) = out.chars().last() { |
| 236 | if last == '\'' || last == '"' || last == '`' { |
| 237 | out = &out[..out.len() - last.len_utf8()]; |
| 238 | } |
| 239 | } |
| 240 | out.to_string() |
| 241 | } |
| 242 | |
| 243 | /// The `= <first 100 UTF-16 units>[...]` initializer signature used by |
| 244 | /// extractVariable (its `.length >= 100` check fires exactly when the slice |
no test coverage detected