import { Aggregation , Datafeed } from '../types/anomaly_detection_jobs' ; export function getAggregations < T > ( obj ) { if ( obj ?. aggregations !== undefined ) return obj . aggregations ; if ( obj ?. aggs !== undefined ) return obj . aggs ; return undefined ; } export const getDatafeedAggregations = ( datafeedConfig ) : Aggregation | undefined => { return getAggregations < Aggregation > ( datafeedConfig ) ; } ;