import { buildRegexForKeyMatch } from './build-regex-for-key-match' ; export function unParseKey ( keySchema , keyToUnParse , interpolations ) { const { exp : keySchemaExp , keys } = buildRegexForKeyMatch ( keySchema , interpolations ) ; const values = keySchemaExp . exec ( keyToUnParse ) ?. splice ( 1 ) ?? ( [ ] as any [ ] ) ; return keys . reduce ( ( acc , key , index ) => { acc [ key ] = values [ index ] ; return acc ; } , { } as Record < string , any > ) ; }