import type { Reducer } from "./api.js" ; import { reduce , reducer } from "./reduce.js" ; /**
 * Reducer which returns the value with the largest magnitude, regardless of
 * sign.
 */ export function maxMag ( ) ; export function maxMag ( xs ) ; export function maxMag ( xs ? ) { return xs ? reduce ( maxMag ( ) , xs ) : reducer ( ( ) => 0 , ( acc , x ) => ( Math . abs ( x ) > Math . abs ( acc ) ? x : acc ) ) ; }