import { readNextDescriptor } from '../utils' ; import { pointerKey } from './types' ; export function parseKeyDef ( pointerMap , keys ) { const defs = [ ] ; do { const { descriptor , consumedLength , releasePrevious , releaseSelf = true , } = readNextDescriptor ( keys ) ; const keyDef = pointerMap . find ( p => p . name === descriptor ) ; if ( keyDef ) { defs . push ( { keyDef , releasePrevious , releaseSelf } ) ; } keys = keys . slice ( consumedLength ) ; } while ( keys ) ; return defs ; }