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

Function generateCommandJsDoc

javascript/selenium-webdriver/generate_bidi.mjs:1253–1270  ·  view source on GitHub ↗
(cmd, paramsRuntime, resultTypeName)

Source from the content-addressed store, hash-verified

1251// required vs. optional is visible in an ordinary hover, matching what Ruby's
1252// generator gives for free via real keyword arguments in the method signature.
1253function generateCommandJsDoc(cmd, paramsRuntime, resultTypeName) {
1254 const { methodStr, paramsTypeName, hasParams } = cmd
1255 const lines = [' /**']
1256 if (hasParams) {
1257 lines.push(` * @param {${paramsTypeName}} params`)
1258 for (const field of paramsRuntime?.fields ?? []) {
1259 const tsType = typeNodeToTs(field.type)
1260 const tag = field.required ? `params.${field.name}` : `[params.${field.name}]`
1261 lines.push(` * @param {${tsType}} ${tag}`)
1262 }
1263 }
1264 lines.push(` * @returns {Promise<${resultTypeName ?? 'void'}>}`)
1265 // A vendor-defined command has no section in the spec (specUrl: null).
1266 const specUrl = cmd.specUrl === undefined ? specSectionUrl(methodStr, 'command') : cmd.specUrl
1267 if (specUrl) lines.push(` * @see ${specUrl}`)
1268 lines.push(' */')
1269 return lines.join('\n')
1270}
1271
1272function generateCommandMethod(cmd, runtimeByTsName) {
1273 const { methodName, methodStr, paramsTypeName, hasParams, resultTypeName } = cmd

Callers 1

generateCommandMethodFunction · 0.85

Calls 3

typeNodeToTsFunction · 0.85
specSectionUrlFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected