mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Convert some usage of indexOf
to startsWith
/includes
where applicable
In many cases in the code you don't actually care about the index itself, but rather just want to know if something exists in a String/Array or if a String starts in a particular way. With modern JavaScript functionality, it's thus possible to remove a number of existing `indexOf` cases.
This commit is contained in:
parent
cdbc33ba06
commit
24a688d6c6
10 changed files with 22 additions and 28 deletions
|
@ -1,5 +1,3 @@
|
|||
/* eslint-disable mozilla/use-includes-instead-of-indexOf */
|
||||
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
|
@ -67,7 +65,7 @@ function flatten(stats) {
|
|||
});
|
||||
});
|
||||
// Use only overall results if not grouped by 'stat'
|
||||
if (options.groupBy.indexOf('stat') < 0) {
|
||||
if (!options.groupBy.includes('stat')) {
|
||||
rows = rows.filter(function(s) {
|
||||
return s.stat === 'Overall';
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue