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

Function generateCommandJsDoc

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

Source from the content-addressed store, hash-verified

1181// required vs. optional is visible in an ordinary hover, matching what Ruby's
1182// generator gives for free via real keyword arguments in the method signature.
1183function generateCommandJsDoc(cmd, paramsRuntime, resultTypeName) {
1184 const { methodStr, paramsTypeName, hasParams } = cmd
1185 const lines = [' /**']
1186 if (hasParams) {
1187 lines.push(` * @param {${paramsTypeName}} params`)
1188 for (const field of paramsRuntime?.fields ?? []) {
1189 const tsType = typeNodeToTs(field.type)
1190 const tag = field.required ? `params.${field.name}` : `[params.${field.name}]`
1191 lines.push(` * @param {${tsType}} ${tag}`)
1192 }
1193 }
1194 lines.push(` * @returns {Promise<${resultTypeName ?? 'void'}>}`)
1195 // A vendor-defined command has no section in the spec (specUrl: null).
1196 const specUrl = cmd.specUrl === undefined ? specSectionUrl(methodStr, 'command') : cmd.specUrl
1197 if (specUrl) lines.push(` * @see ${specUrl}`)
1198 lines.push(' */')
1199 return lines.join('\n')
1200}
1201
1202function generateCommandMethod(cmd, runtimeByTsName) {
1203 const { methodName, methodStr, paramsTypeName, hasParams, resultTypeName } = cmd

Callers 1

generateCommandMethodFunction · 0.85

Calls 2

typeNodeToTsFunction · 0.85
specSectionUrlFunction · 0.85

Tested by

no test coverage detected