import { isObject , isString } from 'lodash' ; interface ITem { [ key ] : string | ITem ; } export function getObjKeyMap ( obj , prefix = '' ) { const result = { } ; Object . keys ( obj ) . forEach ( key => { if ( isString ( obj [ key ] ) ) { result [ key ] = prefix ? `${ prefix }.${ key }` : key ; } else if ( isObject ( obj [ key ] ) ) { result [ key ] = getObjKeyMap ( obj [ key ] as ITem , prefix ? `${ prefix }.${ key }` : key ) ; } } ) ; return result ; }