import { generateKeyPathString } from '@goldfishjs/reactive' ; export type KeyPathList = ( string | number ) [ ] ; let cache = { } ; export function save ( keyPathList ) { const keyPathString = generateKeyPathString ( keyPathList ) ; cache [ keyPathString ] = keyPathList ; return keyPathString ; } export function clear ( ) { cache = { } ; } export function get ( keyPathString ) { const keyPathList = cache [ keyPathString ] ; if ( ! keyPathList ) { throw new Error ( `No such key path string: ${ keyPathString }` ) ; } return keyPathList ; }