function getPropertyByPath ( source , path ) { if ( typeof path === 'string' && Object . prototype . hasOwnProperty . call ( source , path ) ) { return source [ path ] ; } const parsedPath = typeof path === 'string' ? path . split ( '.' ) : path ; return parsedPath . reduce ( ( previous , key ) : unknown => { if ( previous === undefined ) { return previous ; } return previous [ key ] ; } , source ) ; } export { getPropertyByPath } ;