MCPcopy
hub / github.com/cure53/DOMPurify / median

Function median

scripts/benchmark.js:191–195  ·  view source on GitHub ↗
(values)

Source from the content-addressed store, hash-verified

189/* ------------------------------------------------------------------ */
190
191function median(values) {
192 const s = [...values].sort((x, y) => x - y);
193 const mid = s.length >> 1;
194 return s.length % 2 ? s[mid] : (s[mid - 1] + s[mid]) / 2;
195}
196
197function percentile(values, p) {
198 const s = [...values].sort((x, y) => x - y);

Callers 1

runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…