export const calculateShownIndex = ( numberOfPieChartSlices , selectedIndex ) : number => { if ( numberOfPieChartSlices > selectedIndex && selectedIndex !== - 1 ) { return selectedIndex ; } else if ( numberOfPieChartSlices <= selectedIndex ) { return numberOfPieChartSlices - 1 ; } return 0 ; } ;