import { variance } from "./variance" ; import { AccessorT , Observer , Accessor } from "./observer" ; function _deviation ( ) { const v = variance ( ) ; return { observe : ( value , idx ) => { v . observe ( value , idx ) ; } , peek : ( ) => { const variance = v . peek ( ) ; return variance !== undefined ? Math . sqrt ( variance ) : variance ; } } ; } export type DeviationAccessor < T > = AccessorT < T , number > ; export function deviation ( ) ; export function deviation < T = any > ( callbackFn ) ; export function deviation < T = any > ( callbackFn ? ) { return callbackFn ? Accessor ( _deviation , callbackFn ) : _deviation ( ) ; }