Removed all instances of == in js files

This commit is contained in:
murgatroid99 2015-01-26 10:13:03 -08:00
parent 1e71e716dc
commit b62fdb2f0b
3 changed files with 6 additions and 5 deletions

View File

@ -52,7 +52,8 @@ var Server = grpc.buildServer([math.Math.service]);
*/ */
function mathDiv(call, cb) { function mathDiv(call, cb) {
var req = call.request; var req = call.request;
if (req.divisor == 0) { // Unary + is explicit coersion to integer
if (+req.divisor === 0) {
cb(new Error('cannot divide by zero')); cb(new Error('cannot divide by zero'));
} }
cb(null, { cb(null, {
@ -89,7 +90,7 @@ function mathSum(call, cb) {
// Here, call is a standard readable Node object Stream // Here, call is a standard readable Node object Stream
var sum = 0; var sum = 0;
call.on('data', function(data) { call.on('data', function(data) {
sum += data.num | 0; sum += (+data.num);
}); });
call.on('end', function() { call.on('end', function() {
cb(null, {num: sum}); cb(null, {num: sum});
@ -104,7 +105,7 @@ function mathDivMany(stream) {
Transform.call(this, options); Transform.call(this, options);
} }
DivTransform.prototype._transform = function(div_args, encoding, callback) { DivTransform.prototype._transform = function(div_args, encoding, callback) {
if (div_args.divisor == 0) { if (+div_args.divisor === 0) {
callback(new Error('cannot divide by zero')); callback(new Error('cannot divide by zero'));
} }
callback(null, { callback(null, {

View File

@ -183,7 +183,7 @@ function pingPong(client, done) {
assert.equal(response.payload.body.limit - response.payload.body.offset, assert.equal(response.payload.body.limit - response.payload.body.offset,
response_sizes[index]); response_sizes[index]);
index += 1; index += 1;
if (index == 4) { if (index === 4) {
call.end(); call.end();
} else { } else {
call.write({ call.write({

View File

@ -233,7 +233,7 @@ function Server(options) {
function handleNewCall(event) { function handleNewCall(event) {
var call = event.call; var call = event.call;
var data = event.data; var data = event.data;
if (data == null) { if (data === null) {
return; return;
} }
server.requestCall(handleNewCall); server.requestCall(handleNewCall);