MCPcopy Create free account
hub / github.com/InverseUI/InverseUI-Recorder / isGuidLike

Function isGuidLike

util/playwright_selector.js:378–405  ·  view source on GitHub ↗

* Check if ID looks like a GUID (from selectorGenerator.ts lines 479-506)

(id)

Source from the content-addressed store, hash-verified

376 * Check if ID looks like a GUID (from selectorGenerator.ts lines 479-506)
377 */
378function isGuidLike(id) {
379 let lastCharacterType;
380 let transitionCount = 0;
381 for (let i = 0; i < id.length; ++i) {
382 const c = id[i];
383 let characterType;
384 if (c === '-' || c === '_')
385 continue;
386 if (c >= 'a' && c <= 'z')
387 characterType = 'lower';
388 else if (c >= 'A' && c <= 'Z')
389 characterType = 'upper';
390 else if (c >= '0' && c <= '9')
391 characterType = 'digit';
392 else
393 characterType = 'other';
394
395 if (characterType === 'lower' && lastCharacterType === 'upper') {
396 lastCharacterType = characterType;
397 continue;
398 }
399
400 if (lastCharacterType && lastCharacterType !== characterType)
401 ++transitionCount;
402 lastCharacterType = characterType;
403 }
404 return transitionCount >= id.length / 4;
405}
406
407/**
408 * Build selector candidates (ported from buildNoTextCandidates and buildTextCandidates)

Callers 1

buildCandidatesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected