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

Function object_key_name_of

codegraph-kernel/src/tsjs/mod.rs:212–218  ·  view source on GitHub ↗

objectKeyName (tree-sitter.ts) without the copy: `text` less one leading and one trailing quote character (`'`, `"`, or backtick).

(text: &str)

Source from the content-addressed store, hash-verified

210/// objectKeyName (tree-sitter.ts) without the copy: `text` less one leading
211/// and one trailing quote character (`'`, `"`, or backtick).
212fn object_key_name_of(text: &str) -> &str {
213 let is_quote = |b: u8| b == b'\'' || b == b'"' || b == b'`';
214 let bytes = text.as_bytes();
215 let from = usize::from(bytes.first().is_some_and(|&b| is_quote(b)));
216 let to = bytes.len() - usize::from(bytes.len() > from && bytes.last().is_some_and(|&b| is_quote(b)));
217 &text[from..to]
218}
219
220/// indexedMemberName (object-member-names.ts): `name` with a `.` before each
221/// word a capital begins, `apiBaseUrl` → `api.Base.Url`, `HTMLParser` →

Callers 1

Calls 3

lenMethod · 0.80
fromFunction · 0.50
firstMethod · 0.45

Tested by

no test coverage detected