UNPKG

@observertc/client-monitor-js

Version:

ObserveRTC Client Integration Javascript Library

1 lines 584 B
export function groupBy(t,e){return t.reduce(((t,n)=>{const r=e(n),o=t.get(r);return o?o.push(n):t.set(r,[n]),t}),new Map)}export function clamp(t,e,n){return Math.min(n,Math.max(e,t))}export function roundNumber(t){if(null!=t)return Math.round(t)}export function calculateEmpiricalDeviation(t){if(t.length<2)return;const e=t.reduce(((t,e)=>t+e),0)/t.length,n=t.map((t=>Math.pow(t-e,2))).reduce(((t,e)=>t+e),0)/(t.length-1);return Math.sqrt(n)}export const NULL_UUID="00000000-0000-0000-0000-000000000000";export function positiveDelta(t,e){if(void 0!==t&&void 0!==e)return t<e?0:t-e}