Skip to content

Commit

Permalink
Use _.sum, see phetsims/chipper#1000
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid authored and zepumph committed Jul 21, 2022
1 parent 2e5e6a1 commit 598ac1c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions js/grunt/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,9 @@ const lint = async ( patterns, options ) => {
const formatter = await eslint.loadFormatter( 'stylish' );
const resultText = formatter.format( results );

const sum = ( a, b ) => a + b;
const count = numbers => numbers.length === 0 ? 0 : numbers.reduce( sum );
const totalWarnings = _.sum( results.map( result => result.warningCount ) );
const totalErrors = _.sum( results.map( result => result.errorCount ) );

const totalWarnings = count( results.map( result => result.warningCount ) );
const totalErrors = count( results.map( result => result.errorCount ) );
const total = totalWarnings + totalErrors;

// 5. Output it.
Expand Down

0 comments on commit 598ac1c

Please sign in to comment.