import { Observer , Accessor , AccessorT } from "./observer" ; function _max ( ) { let max ; return { observe : ( value , idx ) => { if ( idx === 0 ) { max = value ; } else if ( max < value ) { max = value ; } } , peek : ( ) => max } ; } export type MaxAccessor < T > = AccessorT < T , number > ; export function max ( ) ; export function max < T = any > ( callbackFn ) ; export function max < T = any > ( callbackFn ? ) { return callbackFn ? Accessor ( _max , callbackFn ) : _max ( ) ; }