@monstermann/tinybench-pretty-printer
Version:
Customizable pretty-printer for tinybench benchmarks
19 lines (18 loc) • 526 B
JavaScript
//#region src/columns/margin.ts
function margin(options = {}) {
return {
header: options?.header ?? "margin",
headerAlignment: options?.headerAlignment ?? "center",
headerStyle: options?.headerStyle ?? ["bold"],
rowAlignment: options?.rowAlignment ?? "center",
rowStyle: options?.rowStyle ?? ["magenta"],
content({ locales, task }) {
return `±${task.result.throughput.rme.toLocaleString(locales, {
maximumFractionDigits: 2,
minimumFractionDigits: 2
})}%`;
}
};
}
//#endregion
export { margin };