export function isUndef ( type ) { return type === 'undefined' ; } export function getLogObject ( obj ) { return JSON . parse ( JSON . stringify ( obj ) ) ; } export function delayCall ( func ) { Promise . resolve ( ) . then ( func ) ; } export function runAtIdle ( func ) { if ( typeof requestIdleCallback === 'function' ) { requestIdleCallback ( func ) ; } else { requestAnimationFrame ( func ) ; } } export function getMinIndex ( nums ) { let min = nums [ 0 ] ; let minIndex = 0 ; for ( let i = 1 , len = nums . length ; i < len ; i ++ ) { const current = nums [ i ] ; if ( current < min ) { min = current ; minIndex = i ; } } return minIndex ; } export function getMax ( nums ) { let max = nums [ 0 ] ; for ( let i = 1 , len = nums . length ; i < len ; i ++ ) { const current = nums [ i ] ; if ( current > max ) { max = current ; } } return max ; }