Skip to content

Commit ae25ed3

Browse files
committed
benchmark: favor === over ==
Refs: #7961 (comment) PR-URL: #8000 Reviewed-By: Brian White <[email protected]> Reviewed-By: Andreas Madsen <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Johan Bergström <[email protected]>
1 parent b7a8a69 commit ae25ed3

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

benchmark/buffers/buffer-bytelength.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function main(conf) {
5050
}
5151

5252
function buildString(str, times) {
53-
if (times == 1) return str;
53+
if (times === 1) return str;
5454

5555
return str + buildString(str, times - 1);
5656
}

benchmark/crypto/cipher-stream.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function main(conf) {
3131
var bob_secret = bob.computeSecret(alice.getPublicKey(), pubEnc, 'hex');
3232

3333
// alice_secret and bob_secret should be the same
34-
assert(alice_secret == bob_secret);
34+
assert(alice_secret === bob_secret);
3535

3636
var alice_cipher = crypto.createCipher(conf.cipher, alice_secret);
3737
var bob_cipher = crypto.createDecipher(conf.cipher, bob_secret);

benchmark/dgram/array-vs-concat.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ function server() {
4646
var onsend = type === 'concat' ? onsendConcat : onsendMulti;
4747

4848
function onsendConcat() {
49-
if (sent++ % num == 0)
49+
if (sent++ % num === 0)
5050
for (var i = 0; i < num; i++) {
5151
socket.send(Buffer.concat(chunk), PORT, '127.0.0.1', onsend);
5252
}
5353
}
5454

5555
function onsendMulti() {
56-
if (sent++ % num == 0)
56+
if (sent++ % num === 0)
5757
for (var i = 0; i < num; i++) {
5858
socket.send(chunk, PORT, '127.0.0.1', onsend);
5959
}

benchmark/dgram/multi-buffer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function server() {
4545
var socket = dgram.createSocket('udp4');
4646

4747
function onsend() {
48-
if (sent++ % num == 0)
48+
if (sent++ % num === 0)
4949
for (var i = 0; i < num; i++)
5050
socket.send(chunk, PORT, '127.0.0.1', onsend);
5151
}

benchmark/dgram/offset-length.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function server() {
3737
var socket = dgram.createSocket('udp4');
3838

3939
function onsend() {
40-
if (sent++ % num == 0)
40+
if (sent++ % num === 0)
4141
for (var i = 0; i < num; i++)
4242
socket.send(chunk, 0, chunk.length, PORT, '127.0.0.1', onsend);
4343
}

benchmark/dgram/single-buffer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function server() {
3737
var socket = dgram.createSocket('udp4');
3838

3939
function onsend() {
40-
if (sent++ % num == 0)
40+
if (sent++ % num === 0)
4141
for (var i = 0; i < num; i++)
4242
socket.send(chunk, PORT, '127.0.0.1', onsend);
4343
}

benchmark/http/_http_simple.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var server = module.exports = http.createServer(function(req, res) {
3737
var status = 200;
3838

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

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

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

70-
} else if (command == 'quit') {
70+
} else if (command === 'quit') {
7171
res.connection.server.close();
7272
body = 'quitting';
7373

74-
} else if (command == 'fixed') {
74+
} else if (command === 'fixed') {
7575
body = fixed;
7676

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

0 commit comments

Comments
 (0)