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

Function dedupeDefs

javascript/selenium-webdriver/normalize_bidi_ast.mjs:460–471  ·  view source on GitHub ↗
(ast)

Source from the content-addressed store, hash-verified

458 * @returns {object[]} A new AST array with duplicate-named defs removed (first wins).
459 */
460export function dedupeDefs(ast) {
461 const seen = new Set()
462 const out = []
463 for (const def of ast) {
464 if (def && typeof def === 'object' && typeof def.Name === 'string') {
465 if (seen.has(def.Name)) continue
466 seen.add(def.Name)
467 }
468 out.push(def)
469 }
470 return out
471}
472
473/**
474 * Apply all normalizations to a raw BiDi AST. Pure — does not mutate `ast`.

Callers 2

normalizeAstFunction · 0.85

Calls 2

addMethod · 0.65
hasMethod · 0.45

Tested by

no test coverage detected