export function nextIdxWithRollover ( current , array ) { return ( current + 1 ) % array . length ; } export function prevIdxWithRollover ( current , array ) { return ( current + array . length - 1 ) % array . length ; } export function nextIdxWithoutRollover ( current , array ) { return Math . min ( array . length - 1 , current + 1 ) ; } export function prevIdxWithoutRollover ( current ) { return Math . max ( 0 , current - 1 ) ; }