allcount / allcountjs

Rapid application development framework for Node.js
http://allcountjs.com
MIT License
402 stars 83 forks source link

Expected a conditional expression and instead saw an assignment #126

Open CharlesHamel opened 8 years ago

CharlesHamel commented 8 years ago

It should be a conditional expression instead of an assignment

nodesocket commented 7 years ago

This looks like a good bug fix. Is this project still being maintained?

ichiriac commented 7 years ago

Hi @CharlesHamel and @nodesocket,

Nope, it's a bad fix. It's a trick in order to do 2 things in one line of code (by the way, it makes it less readable).

Example :

let foo;
if (foo = testFunction()) { 
  // .... do something with foo result
}

Is the same as :

let foo = testFunction();
if (foo) { 
  // .... do something with foo result
}

Your PR introduce a bug as : LINE 16 fieldType is not defined, LINE 17 fieldType so could not be used as an equality, and LINE 18, as it's not initialised, could not provide a fromBsonValue as it's undefined.