benchmark: favor === over == · nodejs/node@ae25ed3

7 files changed

lines changed

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

}

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);

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

}

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

}

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

}

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

}

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);