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

Function normalizeDottedName

javascript/selenium-webdriver/generate_bidi.mjs:362–382  ·  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

360 * "browsingContext.Info" → "BrowsingContextInfo"
361 */
362function normalizeDottedName(name) {
363 return name
364 .split('.')
365 .map((part) =>
366 // A schema name segment may itself be hyphenated (e.g. the CDDL prelude
367 // range aliases 'js-uint'/'js-int'), which isn't a valid TS identifier
368 // character — split on '-' too so each word gets its own PascalCase turn.
369 part
370 .split('-')
371 .map((word) => {
372 const titled = word.charAt(0).toUpperCase() + word.slice(1)
373 // Normalize acronym runs to match cddl2ts output:
374 // CSPParameters → CspParameters HTMLCollection → HtmlCollection
375 // Rule: 2+ uppercase letters followed by an uppercase+lowercase pair (or end
376 // of string) → keep only the first uppercase and lowercase the rest.
377 return titled.replace(/([A-Z]{2,})(?=[A-Z][a-z]|$)/g, (m) => m[0] + m.slice(1).toLowerCase())
378 })
379 .join(''),
380 )
381 .join('')
382}
383
384/**
385 * 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