Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Expose P2P service API and clean up logs #10552

Merged
merged 11 commits into from
Dec 10, 2024
Prev Previous commit
Next Next commit
Fix
spalladino committed Dec 9, 2024
commit 4ac396fb7c9bf0b56d8d5ab867cb62b5cb5060c8
2 changes: 1 addition & 1 deletion yarn-project/foundation/src/collection/array.ts
Original file line number Diff line number Diff line change
@@ -151,7 +151,7 @@ export function median(arr: number[]) {
if (arr.length === 0) {
return undefined;
}
const sorted = arr.toSorted((a, b) => a - b);
const sorted = [...arr].sort((a, b) => a - b);
const mid = Math.floor(sorted.length / 2);
return sorted.length % 2 !== 0 ? sorted[mid] : (sorted[mid - 1] + sorted[mid]) / 2;
}