import { SeriesList , LegendItemList } from '../types' ; const getDefaultLegendItems = ( series ) : LegendItemList => series . map ( ( { name : text , color } ) => ( { text , color } ) ) ; const getPieLegendItems = ( series ) : LegendItemList => series [ 0 ] . points . map ( ( { argument : text , color } ) => ( { text , color } ) ) ; const isSinglePieSeriesCase = ( series ) => ( series . length === 1 && 'innerRadius' in series [ 0 ] && 'outerRadius' in series [ 0 ] ) ; internal export const getLegendItems = ( series ) => ( ( isSinglePieSeriesCase ( series ) ? getPieLegendItems : getDefaultLegendItems ) ( series ) ) ;