From 5609403ad0fde252d3e746d8ec5e63618d42c5ab Mon Sep 17 00:00:00 2001 From: Sam Saccone Date: Fri, 21 Oct 2016 14:58:16 -0700 Subject: [PATCH] Migrate printer type names to be inline w/ core. --- lighthouse-cli/printer.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lighthouse-cli/printer.ts b/lighthouse-cli/printer.ts index 8012c9c52abb..e47d71300e2e 100644 --- a/lighthouse-cli/printer.ts +++ b/lighthouse-cli/printer.ts @@ -27,7 +27,7 @@ enum OutputMode { pretty, json, html }; type Mode = 'pretty' | 'json' | 'html'; const Modes = ['pretty', 'json', 'html']; -interface SubScore { +interface AuditResult { displayValue: string; debugString: string; score: number; @@ -38,16 +38,16 @@ interface SubScore { }; } -interface Score { +interface AggregationResultItem { overall: number; name: string; scored: boolean; - subItems: Array; + subItems: Array; } interface Aggregation { name: string; - score: Array; + score: Array; } interface Results { @@ -88,7 +88,7 @@ function checkOutputPath(path: string): string { return path; } -function formatScore(score: boolean | number | string, suffix?: string) { +function formatAggregationResultItem(score: boolean | number | string, suffix?: string) { // Until we only support node 6 we can not use default args. suffix = suffix || ''; @@ -147,19 +147,19 @@ function createOutput(results: Results, outputMode: OutputMode): string { const score = (item.overall * 100).toFixed(0); if (item.name) { - output += `${bold}${item.name}${reset}: ${item.scored ? formatScore(score, '%') : ''}\n`; + output += `${bold}${item.name}${reset}: ${item.scored ? formatAggregationResultItem(score, '%') : ''}\n`; } item.subItems.forEach(subitem => { - let subscore: SubScore; + let subscore: AuditResult; if (typeof subitem === 'string') { subscore = results.audits[subitem as string]; } else { - subscore = subitem as SubScore; + subscore = subitem as AuditResult; } - let lineItem = ` ── ${formatScore(subscore.score)} ${subscore.description}`; + let lineItem = ` ── ${formatAggregationResultItem(subscore.score)} ${subscore.description}`; if (subscore.displayValue) { lineItem += ` (${bold}${subscore.displayValue}${reset})`; }