Skip to content

Commit

Permalink
benchmark: favor === over ==
Browse files Browse the repository at this point in the history
Refs: nodejs#7961 (comment)
PR-URL: nodejs#8000
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
  • Loading branch information
Trott committed Aug 9, 2016
1 parent b7a8a69 commit ae25ed3
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-bytelength.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function main(conf) {
}

function buildString(str, times) {
if (times == 1) return str;
if (times === 1) return str;

return str + buildString(str, times - 1);
}
2 changes: 1 addition & 1 deletion benchmark/crypto/cipher-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function main(conf) {
var bob_secret = bob.computeSecret(alice.getPublicKey(), pubEnc, 'hex');

// alice_secret and bob_secret should be the same
assert(alice_secret == bob_secret);
assert(alice_secret === bob_secret);

var alice_cipher = crypto.createCipher(conf.cipher, alice_secret);
var bob_cipher = crypto.createDecipher(conf.cipher, bob_secret);
Expand Down
4 changes: 2 additions & 2 deletions benchmark/dgram/array-vs-concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ function server() {
var onsend = type === 'concat' ? onsendConcat : onsendMulti;

function onsendConcat() {
if (sent++ % num == 0)
if (sent++ % num === 0)
for (var i = 0; i < num; i++) {
socket.send(Buffer.concat(chunk), PORT, '127.0.0.1', onsend);
}
}

function onsendMulti() {
if (sent++ % num == 0)
if (sent++ % num === 0)
for (var i = 0; i < num; i++) {
socket.send(chunk, PORT, '127.0.0.1', onsend);
}
Expand Down
2 changes: 1 addition & 1 deletion benchmark/dgram/multi-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function server() {
var socket = dgram.createSocket('udp4');

function onsend() {
if (sent++ % num == 0)
if (sent++ % num === 0)
for (var i = 0; i < num; i++)
socket.send(chunk, PORT, '127.0.0.1', onsend);
}
Expand Down
2 changes: 1 addition & 1 deletion benchmark/dgram/offset-length.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function server() {
var socket = dgram.createSocket('udp4');

function onsend() {
if (sent++ % num == 0)
if (sent++ % num === 0)
for (var i = 0; i < num; i++)
socket.send(chunk, 0, chunk.length, PORT, '127.0.0.1', onsend);
}
Expand Down
2 changes: 1 addition & 1 deletion benchmark/dgram/single-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function server() {
var socket = dgram.createSocket('udp4');

function onsend() {
if (sent++ % num == 0)
if (sent++ % num === 0)
for (var i = 0; i < num; i++)
socket.send(chunk, PORT, '127.0.0.1', onsend);
}
Expand Down
12 changes: 6 additions & 6 deletions benchmark/http/_http_simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var server = module.exports = http.createServer(function(req, res) {
var status = 200;

var n, i;
if (command == 'bytes') {
if (command === 'bytes') {
n = ~~arg;
if (n <= 0)
throw new Error('bytes called with n <= 0');
Expand All @@ -46,7 +46,7 @@ var server = module.exports = http.createServer(function(req, res) {
}
body = storedBytes[n];

} else if (command == 'buffer') {
} else if (command === 'buffer') {
n = ~~arg;
if (n <= 0)
throw new Error('buffer called with n <= 0');
Expand All @@ -58,7 +58,7 @@ var server = module.exports = http.createServer(function(req, res) {
}
body = storedBuffer[n];

} else if (command == 'unicode') {
} else if (command === 'unicode') {
n = ~~arg;
if (n <= 0)
throw new Error('unicode called with n <= 0');
Expand All @@ -67,14 +67,14 @@ var server = module.exports = http.createServer(function(req, res) {
}
body = storedUnicode[n];

} else if (command == 'quit') {
} else if (command === 'quit') {
res.connection.server.close();
body = 'quitting';

} else if (command == 'fixed') {
} else if (command === 'fixed') {
body = fixed;

} else if (command == 'echo') {
} else if (command === 'echo') {
res.writeHead(200, { 'Content-Type': 'text/plain',
'Transfer-Encoding': 'chunked' });
req.pipe(res);
Expand Down

0 comments on commit ae25ed3

Please sign in to comment.