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

Function unionNode

javascript/selenium-webdriver/project_bidi_schema.mjs:164–172  ·  view source on GitHub ↗
(arms)

Source from the content-addressed store, hash-verified

162// scalar arm admits (input.Origin's "viewport" / "pointer"), so a binding can reject a wrong
163// string too, not just a wrong primitive. Derived once, in the schema, not re-detected per binding.
164function unionNode(arms) {
165 const node = { union: arms }
166 const primitives = [...new Set(arms.map(scalarArmPrimitive).filter((p) => p !== undefined))]
167 if (primitives.length === 1) node.scalar = primitives[0]
168 else if (primitives.length > 1) node.scalar = primitives
169 const values = arms.filter((a) => a.const !== undefined).map((a) => a.const)
170 if (values.length) node.scalarValues = values
171 return node
172}
173
174function projectRef(type) {
175 const all = typeList(type)

Callers 2

projectRefFunction · 0.85
projectEntryFunction · 0.85

Calls 2

filterMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected