MCPcopy Create free account
hub / github.com/aeroxy/chrome-devtools-cli / to_friendly

Function to_friendly

src/friendly.rs:31–36  ·  view source on GitHub ↗

Convert a target ID to a friendly "adjective-noun" name.

(target_id: &str)

Source from the content-addressed store, hash-verified

29
30/// Convert a target ID to a friendly "adjective-noun" name.
31pub fn to_friendly(target_id: &str) -> String {
32 let h = simple_hash(target_id);
33 let adj = ADJECTIVES[(h % ADJECTIVES.len() as u64) as usize];
34 let noun = NOUNS[((h / ADJECTIVES.len() as u64) % NOUNS.len() as u64) as usize];
35 format!("{adj}-{noun}")
36}
37
38/// Check if a string looks like a friendly name (contains a hyphen, no hex chars only).
39pub fn is_friendly(s: &str) -> bool {

Callers 6

run_directFunction · 0.85
resolve_pageMethod · 0.85
list_pagesFunction · 0.85
close_pageFunction · 0.85
select_pageFunction · 0.85
execute_commandFunction · 0.85

Calls 1

simple_hashFunction · 0.85

Tested by

no test coverage detected