Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 1x 8x 8x 1x 7x 1x 7x 1x 1x 7x | const usePercentage = ({percentage, mainBarPercentage, extraBarPercentage}) => {
const response = []
if (Array.isArray(percentage) && percentage.length >= 0 && percentage.every(number => typeof number === 'number')) {
return percentage
}
if (typeof mainBarPercentage === 'number') {
response.push(mainBarPercentage)
}
if (typeof extraBarPercentage === 'number') {
response[1] = extraBarPercentage
response[0] = response[0] === undefined ? 0 : response[0]
}
return response.length === 0 && typeof percentage === 'number' ? [percentage] : response
}
export default usePercentage
|