MCPcopy Create free account
hub / github.com/testing-library/user-event / parseKeyDef

Function parseKeyDef

src/pointer/parseKeyDef.ts:4–28  ·  view source on GitHub ↗
(pointerMap: pointerKey[], keys: string)

Source from the content-addressed store, hash-verified

2import {readNextDescriptor} from '../utils'
3
4export function parseKeyDef(pointerMap: pointerKey[], keys: string) {
5 const defs: Array<{
6 keyDef: pointerKey
7 releasePrevious: boolean
8 releaseSelf: boolean
9 }> = []
10
11 do {
12 const {
13 descriptor,
14 consumedLength,
15 releasePrevious,
16 releaseSelf = true,
17 } = readNextDescriptor(keys, 'pointer')
18 const keyDef = pointerMap.find(p => p.name === descriptor)
19
20 if (keyDef) {
21 defs.push({keyDef, releasePrevious, releaseSelf})
22 }
23
24 keys = keys.slice(consumedLength)
25 } while (keys)
26
27 return defs
28}

Callers 2

pointerFunction · 0.90
parseKeyDef.tsFile · 0.90

Calls 1

readNextDescriptorFunction · 0.90

Tested by

no test coverage detected