import { find } from 'lodash' ; import { IResponseAggConfig } from './lib/get_response_agg_config_class' ; export const getPercentileValue = < TAggConfig extends IResponseAggConfig > ( agg , bucket ) => { const { values } = bucket [ agg . parentId ] ; const percentile = find ( values , ( { key } ) => key === agg . key ) ; return percentile ? percentile . value : NaN ; } ;