File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change 99//------------------------------------------------------------------------------
1010
1111const chalk = require ( "chalk" ) ,
12- table = require ( "table" ) . table ,
13- pluralize = require ( "pluralize" ) ;
12+ table = require ( "table" ) . table ;
1413
1514//------------------------------------------------------------------------------
1615// Helpers
1716//------------------------------------------------------------------------------
1817
18+ /**
19+ * Given a word and a count, append an "s" if count is not one.
20+ * @param {string } word A word.
21+ * @param {number } count Quantity.
22+ * @returns {string } The original word with an s on the end if count is not one.
23+ */
24+ function pluralize ( word , count ) {
25+ return ( count === 1 ? word : `${ word } s` ) ;
26+ }
27+
1928/**
2029 * Draws text table.
2130 * @param {Array<Object> } messages Error messages relating to a specific file.
@@ -129,10 +138,10 @@ module.exports = function(report) {
129138
130139 result += `\n${ table ( [
131140 [
132- chalk . red ( pluralize ( " Error" , errorCount , true ) )
141+ chalk . red ( pluralize ( ` ${ errorCount } Error` , errorCount ) )
133142 ] ,
134143 [
135- chalk . yellow ( pluralize ( " Warning" , warningCount , true ) )
144+ chalk . yellow ( pluralize ( ` ${ warningCount } Warning` , warningCount ) )
136145 ]
137146 ] , {
138147 columns : {
You can’t perform that action at this time.
0 commit comments