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

Function normalizeDottedName

javascript/selenium-webdriver/generate_bidi.mjs:385–405  ·  view source on GitHub ↗

* Convert a dotted CDDL name to PascalCase TypeScript name. * "browsingContext.Info" → "BrowsingContextInfo"

(name)

Source from the content-addressed store, hash-verified

383 * "browsingContext.Info" → "BrowsingContextInfo"
384 */
385function normalizeDottedName(name) {
386 return name
387 .split('.')
388 .map((part) =>
389 // A schema name segment may itself be hyphenated (e.g. the CDDL prelude
390 // range aliases 'js-uint'/'js-int'), which isn't a valid TS identifier
391 // character — split on '-' too so each word gets its own PascalCase turn.
392 part
393 .split('-')
394 .map((word) => {
395 const titled = word.charAt(0).toUpperCase() + word.slice(1)
396 // Normalize acronym runs to match cddl2ts output:
397 // CSPParameters → CspParameters HTMLCollection → HtmlCollection
398 // Rule: 2+ uppercase letters followed by an uppercase+lowercase pair (or end
399 // of string) → keep only the first uppercase and lowercase the rest.
400 return titled.replace(/([A-Z]{2,})(?=[A-Z][a-z]|$)/g, (m) => m[0] + m.slice(1).toLowerCase())
401 })
402 .join(''),
403 )
404 .join('')
405}
406
407/**
408 * Walk the `CommandData` or `EventData` union type hierarchy and collect all

Callers 9

schemaToCommandFunction · 0.85
buildVendorModulesFunction · 0.85
schemaToEventsFunction · 0.85
typeNodeToTsFunction · 0.85
generateTypeDeclarationFunction · 0.85
resolveAliasRuntimeFunction · 0.85
generateDomainFileFunction · 0.85
localSchemaNameFunction · 0.85

Calls 3

splitMethod · 0.80
charAtMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected