import { GenericObject } from '../types' ; export const findObjectByPath = ( message , pathArr ) : GenericObject | undefined => { let result = message ; for ( let i = 0 ; i < pathArr . length ; i += 1 ) { if ( result [ pathArr [ i ] ] === undefined ) { return undefined ; } result = result [ pathArr [ i ] ] as GenericObject ; } return result ; } ;