MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / nameAllocator

Function nameAllocator

javascript/selenium-webdriver/normalize_bidi_ast.mjs:75–84  ·  view source on GitHub ↗

A factory for collision-free synthetic def names within a known name set.

(existing)

Source from the content-addressed store, hash-verified

73
74/** A factory for collision-free synthetic def names within a known name set. */
75function nameAllocator(existing) {
76 const taken = new Set(existing)
77 return (candidate) => {
78 let name = candidate
79 let n = 2
80 while (taken.has(name)) name = `${candidate}${n++}`
81 taken.add(name)
82 return name
83 }
84}
85
86/** True when `entry` is a reference to a named group (`{Type:'group', Value}`). */
87function isGroupRef(entry) {

Callers 3

hoistInlineEnumsFunction · 0.85
hoistInlineRecordsFunction · 0.85

Calls 2

addMethod · 0.65
hasMethod · 0.45

Tested by

no test coverage detected