mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-08-04 06:16:11 +00:00
b51d5ba0a0
* refactor(gh): unify frontend diagnostics * refactor(gh): unify frontend diagnostics markdown rendering * docs(gh): restore frontend diagnostics comments * wip * fix * refactor: 呼称をbase/headに統一 * tweak * Update types.ts * fix
22 lines
705 B
TypeScript
22 lines
705 B
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import { median } from 'diagnostics-shared/stats';
|
|
import type { BrowserDiagnostics } from './types';
|
|
|
|
export function summarizeBrowserDiagnostics(samples: BrowserDiagnostics[]): BrowserDiagnostics {
|
|
const medianOf = (select: (sample: BrowserDiagnostics) => number) => median(samples.map(select));
|
|
|
|
return {
|
|
pageErrorCount: medianOf(sample => sample.pageErrorCount),
|
|
console: {
|
|
log: medianOf(sample => sample.console.log),
|
|
warning: medianOf(sample => sample.console.warning),
|
|
error: medianOf(sample => sample.console.error),
|
|
info: medianOf(sample => sample.console.info),
|
|
},
|
|
};
|
|
}
|