objectKeyName (tree-sitter.ts): strip ONE leading and ONE trailing quote character (`'`, `"`, or backtick).
(s: &str)
| 130 | /// objectKeyName (tree-sitter.ts): strip ONE leading and ONE trailing quote |
| 131 | /// character (`'`, `"`, or backtick). |
| 132 | pub fn object_key_name(s: &str) -> String { |
| 133 | let mut out = s; |
| 134 | if let Some(first) = out.chars().next() { |
| 135 | if first == '\'' || first == '"' || first == '`' { |
| 136 | out = &out[first.len_utf8()..]; |
| 137 | } |
| 138 | } |
| 139 | if let Some(last) = out.chars().last() { |
| 140 | if last == '\'' || last == '"' || last == '`' { |
| 141 | out = &out[..out.len() - last.len_utf8()]; |
| 142 | } |
| 143 | } |
| 144 | out.to_string() |
| 145 | } |
| 146 | |
| 147 | /// The `= <first 100 UTF-16 units>[...]` initializer signature used by |
| 148 | /// extractVariable (its `.length >= 100` check fires exactly when the slice |
no test coverage detected