UNPKG

aureooms-js-array

Version:

array manipulation code bricks for JavaScript

26 lines (14 loc) 236 B
export function max ( compare, a, i, j ) { var key, tmp; if ( i >= j ) { return undefined; } key = a[i]; for ( ++i ; i < j ; ++i ) { tmp = a[i]; if ( compare( tmp, key ) > 0 ) { key = tmp; } } return key; }