Skip to content

Commit

Permalink
Reduce JS confusion on assignment in while()
Browse files Browse the repository at this point in the history
Without this change, the JS runtime warns about a potential mistype
of an assignment vs equality check.

   JS WARNING: [.../[email protected]/extension.js 109]: test for equality (==) mistyped as assignment (=)?

The fix is easy, put the assigment inside its own set of () which is
parsed by JS before the boolean evaluation of 'line'.

Signed-off-by: David Sommerseth <[email protected]>
  • Loading branch information
dsommers committed Dec 7, 2020
1 parent c2316fb commit 4ce8505
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function parseStat(forceDot = false) {

let count = 0;
let line;
while (line = dstream.read_line(null)) {
while ((line = dstream.read_line(null))) {
line = String(line);
let fields = line.split(/ +/);
if (fields.length<=2) break;
Expand Down

0 comments on commit 4ce8505

Please sign in to comment.