diff --git a/benchmark/_cli.js b/benchmark/_cli.js index 0c39c0b1931f48..36757c1e9b61fe 100644 --- a/benchmark/_cli.js +++ b/benchmark/_cli.js @@ -6,10 +6,8 @@ const path = require('path'); // Create an object of all benchmark scripts const benchmarks = {}; fs.readdirSync(__dirname) - .filter(function(name) { - return fs.statSync(path.resolve(__dirname, name)).isDirectory(); - }) - .forEach(function(category) { + .filter((name) => fs.statSync(path.resolve(__dirname, name)).isDirectory()) + .forEach((category) => { benchmarks[category] = fs.readdirSync(path.resolve(__dirname, category)) .filter((filename) => filename[0] !== '.' && filename[0] !== '_'); }); diff --git a/benchmark/buffers/buffer-bytelength.js b/benchmark/buffers/buffer-bytelength.js index fa8852a233ea88..4caad3014455ca 100644 --- a/benchmark/buffers/buffer-bytelength.js +++ b/benchmark/buffers/buffer-bytelength.js @@ -12,7 +12,7 @@ const chars = [ 'hello brendan!!!', // 1 byte 'ΰαβγδεζηθικλμνξο', // 2 bytes '挰挱挲挳挴挵挶挷挸挹挺挻挼挽挾挿', // 3 bytes - '𠜎𠜱𠝹𠱓𠱸𠲖𠳏𠳕𠴕𠵼𠵿𠸎𠸏𠹷𠺝𠺢' // 4 bytes + '𠜎𠜱𠝹𠱓𠱸𠲖𠳏𠳕𠴕𠵼𠵿𠸎𠸏𠹷𠺝𠺢', // 4 bytes ]; function main({ n, len, encoding }) { @@ -33,9 +33,7 @@ function main({ n, len, encoding }) { } // Check the result to ensure it is *properly* optimized - results = strings.map(function(val) { - return Buffer.byteLength(val, encoding); - }); + results = strings.map((val) => Buffer.byteLength(val, encoding)); } bench.start(); diff --git a/benchmark/buffers/buffer-fill.js b/benchmark/buffers/buffer-fill.js index 590946bce96544..b497597fa1360b 100644 --- a/benchmark/buffers/buffer-fill.js +++ b/benchmark/buffers/buffer-fill.js @@ -12,7 +12,7 @@ const bench = common.createBenchmark(main, { 'fill("t", "utf8")', 'fill("t", 0, "utf8")', 'fill("t", 0)', - 'fill(Buffer.alloc(1), 0)' + 'fill(Buffer.alloc(1), 0)', ], size: [2 ** 8, 2 ** 13, 2 ** 16], n: [2e4] diff --git a/benchmark/buffers/buffer-from.js b/benchmark/buffers/buffer-from.js index 6f2358bcf296ab..6db7b7fe972599 100644 --- a/benchmark/buffers/buffer-from.js +++ b/benchmark/buffers/buffer-from.js @@ -12,7 +12,7 @@ const bench = common.createBenchmark(main, { 'string', 'string-utf8', 'string-base64', - 'object' + 'object', ], len: [10, 2048], n: [2048] diff --git a/benchmark/buffers/buffer-indexof.js b/benchmark/buffers/buffer-indexof.js index 26d82c506db3b0..f3b9dcf1fac5d8 100644 --- a/benchmark/buffers/buffer-indexof.js +++ b/benchmark/buffers/buffer-indexof.js @@ -18,7 +18,7 @@ const searchStrings = [ 'Soo--oop', 'aaaaaaaaaaaaaaaaa', 'venture to go near the house till she had brought herself down to', - ' to the Caterpillar' + ' to the Caterpillar', ]; const bench = common.createBenchmark(main, { diff --git a/benchmark/buffers/buffer-normalize-encoding.js b/benchmark/buffers/buffer-normalize-encoding.js index 7a820465bd5d6b..e33f7e0bc2ab47 100644 --- a/benchmark/buffers/buffer-normalize-encoding.js +++ b/benchmark/buffers/buffer-normalize-encoding.js @@ -25,7 +25,7 @@ const bench = common.createBenchmark(main, { 'utf16le', 'UTF16LE', 'utf8', - 'UTF8' + 'UTF8', ], n: [1e6] }, { diff --git a/benchmark/buffers/buffer-read-with-byteLength.js b/benchmark/buffers/buffer-read-with-byteLength.js index 93deab2ab037fe..65d5f8f01ee73b 100644 --- a/benchmark/buffers/buffer-read-with-byteLength.js +++ b/benchmark/buffers/buffer-read-with-byteLength.js @@ -5,7 +5,7 @@ const types = [ 'IntBE', 'IntLE', 'UIntBE', - 'UIntLE' + 'UIntLE', ]; const bench = common.createBenchmark(main, { diff --git a/benchmark/buffers/buffer-read.js b/benchmark/buffers/buffer-read.js index eccbdc507d6fa2..38a9a847b3c742 100644 --- a/benchmark/buffers/buffer-read.js +++ b/benchmark/buffers/buffer-read.js @@ -15,7 +15,7 @@ const types = [ 'FloatLE', 'FloatBE', 'DoubleLE', - 'DoubleBE' + 'DoubleBE', ]; const bench = common.createBenchmark(main, { diff --git a/benchmark/buffers/buffer-write-string.js b/benchmark/buffers/buffer-write-string.js index 37d4fda52c04e3..6bd98ba4af9d87 100644 --- a/benchmark/buffers/buffer-write-string.js +++ b/benchmark/buffers/buffer-write-string.js @@ -3,7 +3,7 @@ const common = require('../common.js'); const bench = common.createBenchmark(main, { encoding: [ - '', 'utf8', 'ascii', 'hex', 'UCS-2', 'utf16le', 'latin1', 'binary' + '', 'utf8', 'ascii', 'hex', 'UCS-2', 'utf16le', 'latin1', 'binary', ], args: [ '', 'offset', 'offset+length' ], len: [10, 2048], diff --git a/benchmark/buffers/buffer-write.js b/benchmark/buffers/buffer-write.js index 556423a15c1c91..33d33a63fc1da1 100644 --- a/benchmark/buffers/buffer-write.js +++ b/benchmark/buffers/buffer-write.js @@ -19,7 +19,7 @@ const types = [ 'FloatLE', 'FloatBE', 'DoubleLE', - 'DoubleBE' + 'DoubleBE', ]; const bench = common.createBenchmark(main, { diff --git a/benchmark/buffers/dataview-set.js b/benchmark/buffers/dataview-set.js index 00a7114bddd860..a22cad933bfe7a 100644 --- a/benchmark/buffers/dataview-set.js +++ b/benchmark/buffers/dataview-set.js @@ -15,7 +15,7 @@ const types = [ 'Float32LE', 'Float32BE', 'Float64LE', - 'Float64BE' + 'Float64BE', ]; const bench = common.createBenchmark(main, { diff --git a/benchmark/child_process/child-process-read-ipc.js b/benchmark/child_process/child-process-read-ipc.js index 3971eb8b39663e..a9e9cdf7fd7914 100644 --- a/benchmark/child_process/child-process-read-ipc.js +++ b/benchmark/child_process/child-process-read-ipc.js @@ -13,7 +13,7 @@ if (process.argv[2] === 'child') { const bench = common.createBenchmark(main, { len: [ 64, 256, 1024, 4096, 16384, 65536, - 65536 << 4, 65536 << 8 + 65536 << 4, 65536 << 8, ], dur: [5] }); @@ -27,11 +27,9 @@ if (process.argv[2] === 'child') { [process.argv[1], 'child', len], options); var bytes = 0; - child.on('message', function(msg) { - bytes += msg.length; - }); + child.on('message', (msg) => { bytes += msg.length; }); - setTimeout(function() { + setTimeout(() => { child.kill(); bench.end(bytes); }, dur * 1000); diff --git a/benchmark/child_process/child-process-read.js b/benchmark/child_process/child-process-read.js index 0ff08af79483b8..3c0144116f589f 100644 --- a/benchmark/child_process/child-process-read.js +++ b/benchmark/child_process/child-process-read.js @@ -25,11 +25,11 @@ function main({ dur, len }) { const child = child_process.spawn('yes', [msg], options); var bytes = 0; - child.stdout.on('data', function(msg) { + child.stdout.on('data', (msg) => { bytes += msg.length; }); - setTimeout(function() { + setTimeout(() => { if (process.platform === 'win32') { // Sometimes there's a yes.exe process left hanging around on Windows... child_process.execSync(`taskkill /f /t /pid ${child.pid}`); diff --git a/benchmark/child_process/spawn-echo.js b/benchmark/child_process/spawn-echo.js index 62f46fb4c0e8b4..8f5c80cd23ba18 100644 --- a/benchmark/child_process/spawn-echo.js +++ b/benchmark/child_process/spawn-echo.js @@ -15,7 +15,7 @@ function go(n, left) { return bench.end(n); const child = spawn('echo', ['hello']); - child.on('exit', function(code) { + child.on('exit', (code) => { if (code) process.exit(code); else diff --git a/benchmark/cluster/echo.js b/benchmark/cluster/echo.js index 90ae7f9fb0b677..73c5971cd41eb2 100644 --- a/benchmark/cluster/echo.js +++ b/benchmark/cluster/echo.js @@ -61,7 +61,7 @@ if (cluster.isMaster) { } } } else { - process.on('message', function(msg) { + process.on('message', (msg) => { process.send(msg); }); } diff --git a/benchmark/compare.js b/benchmark/compare.js index e7866b60e36418..fe465eb9762129 100644 --- a/benchmark/compare.js +++ b/benchmark/compare.js @@ -72,7 +72,7 @@ if (showProgress) { execPath: cli.optional[job.binary] }); - child.on('message', function(data) { + child.on('message', (data) => { if (data.type === 'report') { // Construct configuration string, " A=a, B=b, ..." let conf = ''; @@ -95,7 +95,7 @@ if (showProgress) { } }); - child.once('close', function(code) { + child.once('close', (code) => { if (code) { process.exit(code); return; diff --git a/benchmark/crypto/cipher-stream.js b/benchmark/crypto/cipher-stream.js index c9989d32dcd20a..584039a1e516e6 100644 --- a/benchmark/crypto/cipher-stream.js +++ b/benchmark/crypto/cipher-stream.js @@ -66,11 +66,11 @@ function main({ api, cipher, type, len, writes }) { function streamWrite(alice, bob, message, encoding, writes) { var written = 0; - bob.on('data', function(c) { + bob.on('data', (c) => { written += c.length; }); - bob.on('end', function() { + bob.on('end', () => { // Gbits const bits = written * 8; const gbits = bits / (1024 * 1024 * 1024); diff --git a/benchmark/crypto/rsa-encrypt-decrypt-throughput.js b/benchmark/crypto/rsa-encrypt-decrypt-throughput.js index 40b69c31f977ca..1295ac850609ab 100644 --- a/benchmark/crypto/rsa-encrypt-decrypt-throughput.js +++ b/benchmark/crypto/rsa-encrypt-decrypt-throughput.js @@ -9,7 +9,7 @@ const keylen_list = ['1024', '2048', '4096']; const RSA_PublicPem = {}; const RSA_PrivatePem = {}; -keylen_list.forEach(function(key) { +keylen_list.forEach((key) => { RSA_PublicPem[key] = fs.readFileSync(`${fixtures_keydir}/rsa_public_${key}.pem`); RSA_PrivatePem[key] = diff --git a/benchmark/crypto/rsa-sign-verify-throughput.js b/benchmark/crypto/rsa-sign-verify-throughput.js index 3a0373b57d0bba..4ea39d1eb6a6ce 100644 --- a/benchmark/crypto/rsa-sign-verify-throughput.js +++ b/benchmark/crypto/rsa-sign-verify-throughput.js @@ -9,7 +9,7 @@ const keylen_list = ['1024', '2048']; const RSA_PublicPem = {}; const RSA_PrivatePem = {}; -keylen_list.forEach(function(key) { +keylen_list.forEach((key) => { RSA_PublicPem[key] = fs.readFileSync(`${fixtures_keydir}/rsa_public_${key}.pem`); RSA_PrivatePem[key] = diff --git a/benchmark/dgram/array-vs-concat.js b/benchmark/dgram/array-vs-concat.js index c73c9538589540..669cf47df40ff2 100644 --- a/benchmark/dgram/array-vs-concat.js +++ b/benchmark/dgram/array-vs-concat.js @@ -43,11 +43,11 @@ function main({ dur, len, num, type, chunks }) { } } - socket.on('listening', function() { + socket.on('listening', () => { bench.start(); onsend(); - setTimeout(function() { + setTimeout(() => { const bytes = sent * len; const gbits = (bytes * 8) / (1024 * 1024 * 1024); bench.end(gbits); diff --git a/benchmark/dgram/multi-buffer.js b/benchmark/dgram/multi-buffer.js index ee74c584e45278..a1c50551b87196 100644 --- a/benchmark/dgram/multi-buffer.js +++ b/benchmark/dgram/multi-buffer.js @@ -33,11 +33,11 @@ function main({ dur, len, num, type, chunks }) { } } - socket.on('listening', function() { + socket.on('listening', () => { bench.start(); onsend(); - setTimeout(function() { + setTimeout(() => { const bytes = (type === 'send' ? sent : received) * len; const gbits = (bytes * 8) / (1024 * 1024 * 1024); bench.end(gbits); @@ -45,7 +45,7 @@ function main({ dur, len, num, type, chunks }) { }, dur * 1000); }); - socket.on('message', function() { + socket.on('message', () => { received++; }); diff --git a/benchmark/dgram/offset-length.js b/benchmark/dgram/offset-length.js index 7c78765cee0d09..7c672acae20404 100644 --- a/benchmark/dgram/offset-length.js +++ b/benchmark/dgram/offset-length.js @@ -29,11 +29,11 @@ function main({ dur, len, num, type }) { } } - socket.on('listening', function() { + socket.on('listening', () => { bench.start(); onsend(); - setTimeout(function() { + setTimeout(() => { const bytes = (type === 'send' ? sent : received) * chunk.length; const gbits = (bytes * 8) / (1024 * 1024 * 1024); bench.end(gbits); @@ -41,7 +41,7 @@ function main({ dur, len, num, type }) { }, dur * 1000); }); - socket.on('message', function() { + socket.on('message', () => { received++; }); diff --git a/benchmark/dgram/single-buffer.js b/benchmark/dgram/single-buffer.js index 0bf650d265c177..d183b9cd1d69a6 100644 --- a/benchmark/dgram/single-buffer.js +++ b/benchmark/dgram/single-buffer.js @@ -29,11 +29,11 @@ function main({ dur, len, num, type }) { } } - socket.on('listening', function() { + socket.on('listening', () => { bench.start(); onsend(); - setTimeout(function() { + setTimeout(() => { const bytes = (type === 'send' ? sent : received) * chunk.length; const gbits = (bytes * 8) / (1024 * 1024 * 1024); bench.end(gbits); @@ -41,7 +41,7 @@ function main({ dur, len, num, type }) { }, dur * 1000); }); - socket.on('message', function() { + socket.on('message', () => { received++; }); diff --git a/benchmark/es/map-bench.js b/benchmark/es/map-bench.js index d34010c6d53f4f..a2f9e2450a1f23 100644 --- a/benchmark/es/map-bench.js +++ b/benchmark/es/map-bench.js @@ -6,7 +6,7 @@ const assert = require('assert'); const bench = common.createBenchmark(main, { method: [ 'object', 'nullProtoObject', 'nullProtoLiteralObject', 'storageObject', - 'fakeMap', 'map' + 'fakeMap', 'map', ], n: [1e6] }); diff --git a/benchmark/events/ee-add-remove.js b/benchmark/events/ee-add-remove.js index 54e680f74ae3e1..2d20736b057568 100644 --- a/benchmark/events/ee-add-remove.js +++ b/benchmark/events/ee-add-remove.js @@ -10,7 +10,7 @@ function main({ n }) { var k; for (k = 0; k < 10; k += 1) - listeners.push(function() {}); + listeners.push(() => {}); bench.start(); for (var i = 0; i < n; i += 1) { diff --git a/benchmark/events/ee-emit.js b/benchmark/events/ee-emit.js index 686ed10d3ecbfd..8f1c2761ffd4ba 100644 --- a/benchmark/events/ee-emit.js +++ b/benchmark/events/ee-emit.js @@ -12,7 +12,7 @@ function main({ n, argc, listeners }) { const ee = new EventEmitter(); for (var k = 0; k < listeners; k += 1) - ee.on('dummy', function() {}); + ee.on('dummy', () => {}); var i; switch (argc) { diff --git a/benchmark/events/ee-listener-count-on-prototype.js b/benchmark/events/ee-listener-count-on-prototype.js index cf6a33f44af9d1..d48e96a46aafe2 100644 --- a/benchmark/events/ee-listener-count-on-prototype.js +++ b/benchmark/events/ee-listener-count-on-prototype.js @@ -8,8 +8,8 @@ function main({ n }) { const ee = new EventEmitter(); for (var k = 0; k < 5; k += 1) { - ee.on('dummy0', function() {}); - ee.on('dummy1', function() {}); + ee.on('dummy0', () => {}); + ee.on('dummy1', () => {}); } bench.start(); diff --git a/benchmark/events/ee-listeners-many.js b/benchmark/events/ee-listeners-many.js index 9a1562eb2c005c..7f9099c41790ea 100644 --- a/benchmark/events/ee-listeners-many.js +++ b/benchmark/events/ee-listeners-many.js @@ -9,8 +9,8 @@ function main({ n }) { ee.setMaxListeners(101); for (var k = 0; k < 50; k += 1) { - ee.on('dummy0', function() {}); - ee.on('dummy1', function() {}); + ee.on('dummy0', () => {}); + ee.on('dummy1', () => {}); } bench.start(); diff --git a/benchmark/events/ee-listeners.js b/benchmark/events/ee-listeners.js index d076dc646c93a7..74b88b043401b5 100644 --- a/benchmark/events/ee-listeners.js +++ b/benchmark/events/ee-listeners.js @@ -8,8 +8,8 @@ function main({ n }) { const ee = new EventEmitter(); for (var k = 0; k < 5; k += 1) { - ee.on('dummy0', function() {}); - ee.on('dummy1', function() {}); + ee.on('dummy0', () => {}); + ee.on('dummy1', () => {}); } bench.start(); diff --git a/benchmark/fixtures/simple-http-server.js b/benchmark/fixtures/simple-http-server.js index d2eda0c085c9f2..0eb7d9ee374615 100644 --- a/benchmark/fixtures/simple-http-server.js +++ b/benchmark/fixtures/simple-http-server.js @@ -13,14 +13,14 @@ const useDomains = process.env.NODE_USE_DOMAINS; if (useDomains) { var domain = require('domain'); const gdom = domain.create(); - gdom.on('error', function(er) { + gdom.on('error', (er) => { console.error('Error on global domain', er); throw er; }); gdom.enter(); } -module.exports = http.createServer(function(req, res) { +module.exports = http.createServer((req, res) => { if (useDomains) { const dom = domain.create(); dom.add(req); diff --git a/benchmark/fs/bench-readdir.js b/benchmark/fs/bench-readdir.js index 0d8ed04856515f..3731e35a5436f4 100644 --- a/benchmark/fs/bench-readdir.js +++ b/benchmark/fs/bench-readdir.js @@ -17,7 +17,7 @@ function main({ n, dir, withFileTypes }) { (function r(cntr) { if (cntr-- <= 0) return bench.end(n); - fs.readdir(fullPath, { withFileTypes }, function() { + fs.readdir(fullPath, { withFileTypes }, () => { r(cntr); }); }(n)); diff --git a/benchmark/fs/bench-realpath.js b/benchmark/fs/bench-realpath.js index de03e71b42d585..97148437f32e9b 100644 --- a/benchmark/fs/bench-realpath.js +++ b/benchmark/fs/bench-realpath.js @@ -24,7 +24,7 @@ function relativePath(n) { (function r(cntr) { if (cntr-- <= 0) return bench.end(n); - fs.realpath(relative_path, function() { + fs.realpath(relative_path, () => { r(cntr); }); }(n)); @@ -34,7 +34,7 @@ function resolvedPath(n) { (function r(cntr) { if (cntr-- <= 0) return bench.end(n); - fs.realpath(resolved_path, function() { + fs.realpath(resolved_path, () => { r(cntr); }); }(n)); diff --git a/benchmark/fs/bench-stat.js b/benchmark/fs/bench-stat.js index 8a401ae0b9d857..0b2e1972e2cb80 100644 --- a/benchmark/fs/bench-stat.js +++ b/benchmark/fs/bench-stat.js @@ -24,7 +24,7 @@ function main({ n, statType }) { fs.closeSync(arg); return; } - fn(arg, function() { + fn(arg, () => { r(cntr, fn); }); }(n, fs[statType])); diff --git a/benchmark/fs/read-stream-throughput.js b/benchmark/fs/read-stream-throughput.js index 7f290a310b592c..bce5f5c996b0a8 100644 --- a/benchmark/fs/read-stream-throughput.js +++ b/benchmark/fs/read-stream-throughput.js @@ -45,16 +45,16 @@ function runTest() { encoding: encoding }); - rs.on('open', function() { + rs.on('open', () => { bench.start(); }); var bytes = 0; - rs.on('data', function(chunk) { + rs.on('data', (chunk) => { bytes += chunk.length; }); - rs.on('end', function() { + rs.on('end', () => { try { fs.unlinkSync(filename); } catch {} // MB/sec bench.end(bytes / (1024 * 1024)); diff --git a/benchmark/fs/readfile-partitioned.js b/benchmark/fs/readfile-partitioned.js index 6e355c158da850..2775793e0b0928 100644 --- a/benchmark/fs/readfile-partitioned.js +++ b/benchmark/fs/readfile-partitioned.js @@ -35,7 +35,7 @@ function main(conf) { var zips = 0; var benchEnded = false; bench.start(); - setTimeout(function() { + setTimeout(() => { const totalOps = reads + zips; benchEnded = true; bench.end(totalOps); diff --git a/benchmark/fs/readfile.js b/benchmark/fs/readfile.js index 36439bdf909f1d..551804b1dbab1f 100644 --- a/benchmark/fs/readfile.js +++ b/benchmark/fs/readfile.js @@ -25,7 +25,7 @@ function main({ len, dur, concurrent }) { var reads = 0; var benchEnded = false; bench.start(); - setTimeout(function() { + setTimeout(() => { benchEnded = true; bench.end(reads); try { fs.unlinkSync(filename); } catch {} diff --git a/benchmark/fs/write-stream-throughput.js b/benchmark/fs/write-stream-throughput.js index baf98f849fed07..a1daa619a352aa 100644 --- a/benchmark/fs/write-stream-throughput.js +++ b/benchmark/fs/write-stream-throughput.js @@ -42,7 +42,7 @@ function main({ dur, encodingType, size }) { f.on('drain', write); f.on('open', write); f.on('close', done); - f.on('finish', function() { + f.on('finish', () => { ended = true; const written = fs.statSync(filename).size / 1024; try { fs.unlinkSync(filename); } catch {} @@ -53,7 +53,7 @@ function main({ dur, encodingType, size }) { function write() { if (!started) { started = true; - setTimeout(function() { + setTimeout(() => { f.end(); }, dur * 1000); bench.start(); diff --git a/benchmark/http/_chunky_http_client.js b/benchmark/http/_chunky_http_client.js index 7728a5d06c60aa..21418a7c26b584 100644 --- a/benchmark/http/_chunky_http_client.js +++ b/benchmark/http/_chunky_http_client.js @@ -54,11 +54,11 @@ function main({ len, n }) { const add = 11; var count = 0; const PIPE = process.env.PIPE_NAME; - var socket = net.connect(PIPE, function() { + var socket = net.connect(PIPE, () => { bench.start(); WriteHTTPHeaders(socket, 1, len); socket.setEncoding('utf8'); - socket.on('data', function(d) { + socket.on('data', (d) => { var did = false; var pattern = 'HTTP/1.1 200 OK\r\n'; if ((d.length === pattern.length && d === pattern) || @@ -84,11 +84,11 @@ function main({ len, n }) { } } }); - socket.on('close', function() { + socket.on('close', () => { console.log('Connection closed'); }); - socket.on('error', function() { + socket.on('error', () => { throw new Error('Connection error'); }); }); diff --git a/benchmark/http/check_invalid_header_char.js b/benchmark/http/check_invalid_header_char.js index c70b0d39db2ffc..46ca9f3d7338f6 100644 --- a/benchmark/http/check_invalid_header_char.js +++ b/benchmark/http/check_invalid_header_char.js @@ -18,7 +18,7 @@ const groupedInputs = { 'sessionid=; Path=/', 'text/html; charset=utf-8', 'text/html; charset=utf-8', '10', 'W/"a-eda64de5"', 'OK', 'Express', 'Express', 'X-HTTP-Method-Override', 'sessionid=; Path=/', - 'application/json' + 'application/json', ], // Put it here so the benchmark result lines will not be super long. @@ -45,7 +45,7 @@ const inputs = [ // Invalid '中文呢', // unicode 'foo\nbar', - '\x7F' + '\x7F', ]; const bench = common.createBenchmark(main, { diff --git a/benchmark/http/check_is_http_token.js b/benchmark/http/check_is_http_token.js index c16993819be93b..eab075249e6f80 100644 --- a/benchmark/http/check_is_http_token.js +++ b/benchmark/http/check_is_http_token.js @@ -35,7 +35,7 @@ const bench = common.createBenchmark(main, { '中文呢', // unicode '((((())))', // invalid ':alternate-protocol', // fast bailout - 'alternate-protocol:' // slow bailout + 'alternate-protocol:', // slow bailout ], n: [1e6], }); diff --git a/benchmark/http/chunked.js b/benchmark/http/chunked.js index 5615395ee0b175..52b4605715c322 100644 --- a/benchmark/http/chunked.js +++ b/benchmark/http/chunked.js @@ -20,21 +20,21 @@ function main({ len, n, c }) { const http = require('http'); const chunk = Buffer.alloc(len, '8'); - const server = http.createServer(function(req, res) { + const server = http.createServer((req, res) => { function send(left) { if (left === 0) return res.end(); res.write(chunk); - setTimeout(function() { + setTimeout(() => { send(left - 1); }, 0); } send(n); }); - server.listen(common.PORT, function() { + server.listen(common.PORT, () => { bench.http({ connections: c - }, function() { + }, () => { server.close(); }); }); diff --git a/benchmark/http/client-request-body.js b/benchmark/http/client-request-body.js index 49bb9130ae3a8a..b5ac2828c6ff1f 100644 --- a/benchmark/http/client-request-body.js +++ b/benchmark/http/client-request-body.js @@ -37,17 +37,17 @@ function main({ dur, len, type, method }) { method: 'POST' }; - const server = http.createServer(function(req, res) { + const server = http.createServer((req, res) => { res.end(); }); - server.listen(options.port, options.host, function() { + server.listen(options.port, options.host, () => { setTimeout(done, dur * 1000); bench.start(); pummel(); }); function pummel() { - const req = http.request(options, function(res) { + const req = http.request(options, (res) => { nreqs++; pummel(); // Line up next request. res.resume(); diff --git a/benchmark/http/cluster.js b/benchmark/http/cluster.js index 667e826f163ba6..35d0ba98d00b43 100644 --- a/benchmark/http/cluster.js +++ b/benchmark/http/cluster.js @@ -21,18 +21,18 @@ function main({ type, len, c }) { const w1 = cluster.fork(); const w2 = cluster.fork(); - cluster.on('listening', function() { + cluster.on('listening', () => { workers++; if (workers < 2) return; - setImmediate(function() { + setImmediate(() => { const path = `/${type}/${len}`; bench.http({ path: path, connections: c - }, function() { + }, () => { w1.destroy(); w2.destroy(); }); diff --git a/benchmark/http/end-vs-write-end.js b/benchmark/http/end-vs-write-end.js index f839e5c3cd9ed9..b4ca560b9a897c 100644 --- a/benchmark/http/end-vs-write-end.js +++ b/benchmark/http/end-vs-write-end.js @@ -43,14 +43,14 @@ function main({ len, type, method, c }) { const fn = method === 'write' ? write : end; - const server = http.createServer(function(req, res) { + const server = http.createServer((req, res) => { fn(res); }); - server.listen(common.PORT, function() { + server.listen(common.PORT, () => { bench.http({ connections: c - }, function() { + }, () => { server.close(); }); }); diff --git a/benchmark/http/headers.js b/benchmark/http/headers.js index 748865afbf3a04..60d800c20cf04f 100644 --- a/benchmark/http/headers.js +++ b/benchmark/http/headers.js @@ -21,15 +21,15 @@ function main({ duplicates, n }) { } } - const server = http.createServer(function(req, res) { + const server = http.createServer((req, res) => { res.writeHead(200, headers); res.end(); }); - server.listen(common.PORT, function() { + server.listen(common.PORT, () => { bench.http({ path: '/', connections: 10 - }, function() { + }, () => { server.close(); }); }); diff --git a/benchmark/http/http_server_for_chunky_client.js b/benchmark/http/http_server_for_chunky_client.js index 1e5a4583669c0f..edcacf5d124e8f 100644 --- a/benchmark/http/http_server_for_chunky_client.js +++ b/benchmark/http/http_server_for_chunky_client.js @@ -12,7 +12,7 @@ tmpdir.refresh(); var server; -server = http.createServer(function(req, res) { +server = http.createServer((req, res) => { const headers = { 'content-type': 'text/plain', 'content-length': '2' @@ -21,7 +21,7 @@ server = http.createServer(function(req, res) { res.end('ok'); }); -server.on('error', function(err) { +server.on('error', (err) => { throw new Error(`server error: ${err}`); }); server.listen(PIPE); @@ -31,7 +31,7 @@ const child = fork( process.argv.slice(2) ); child.on('message', common.sendResult); -child.on('close', function(code) { +child.on('close', (code) => { server.close(); assert.strictEqual(code, 0); }); diff --git a/benchmark/http/set-header.js b/benchmark/http/set-header.js index f0987f2cc77150..01cd8492dff729 100644 --- a/benchmark/http/set-header.js +++ b/benchmark/http/set-header.js @@ -19,13 +19,13 @@ function main({ res }) { process.env.PORT = PORT; var server = require('../fixtures/simple-http-server.js') .listen(PORT) - .on('listening', function() { + .on('listening', () => { const path = `/${type}/${len}/${chunks}/normal/${chunkedEnc}`; bench.http({ path: path, connections: c - }, function() { + }, () => { server.close(); }); }); diff --git a/benchmark/http/set_header.js b/benchmark/http/set_header.js index 22de61b3f847a3..4129e4fee0cee7 100644 --- a/benchmark/http/set_header.js +++ b/benchmark/http/set_header.js @@ -11,7 +11,7 @@ const bench = common.createBenchmark(main, { 'Content-Type', 'Content-Length', 'Connection', - 'Transfer-Encoding' + 'Transfer-Encoding', ], n: [1e6], }); diff --git a/benchmark/http/simple.js b/benchmark/http/simple.js index 6d1851c45e17b2..c6faaaa9efdfd2 100644 --- a/benchmark/http/simple.js +++ b/benchmark/http/simple.js @@ -13,13 +13,13 @@ const bench = common.createBenchmark(main, { function main({ type, len, chunks, c, chunkedEnc, res }) { var server = require('../fixtures/simple-http-server.js') .listen(common.PORT) - .on('listening', function() { + .on('listening', () => { const path = `/${type}/${len}/${chunks}/normal/${chunkedEnc}`; bench.http({ path: path, connections: c - }, function() { + }, () => { server.close(); }); }); diff --git a/benchmark/http/upgrade.js b/benchmark/http/upgrade.js index 6b39323396a2e3..c286cdb2644d0c 100644 --- a/benchmark/http/upgrade.js +++ b/benchmark/http/upgrade.js @@ -21,14 +21,14 @@ const resData = 'HTTP/1.1 101 Web Socket Protocol Handshake\r\n' + function main({ n }) { var server = require('../fixtures/simple-http-server.js') .listen(common.PORT) - .on('listening', function() { + .on('listening', () => { bench.start(); - doBench(server.address(), n, function() { + doBench(server.address(), n, () => { bench.end(n); server.close(); }); }) - .on('upgrade', function(req, socket, upgradeHead) { + .on('upgrade', (req, socket, upgradeHead) => { socket.resume(); socket.write(resData); socket.end(); @@ -45,7 +45,7 @@ function doBench(address, count, done) { conn.write(reqData); conn.resume(); - conn.on('end', function() { + conn.on('end', () => { doBench(address, count - 1, done); }); } diff --git a/benchmark/misc/arguments.js b/benchmark/misc/arguments.js index 2e5df6188b07f5..5b0cb0e2ca1488 100644 --- a/benchmark/misc/arguments.js +++ b/benchmark/misc/arguments.js @@ -7,7 +7,7 @@ const methods = [ 'restAndSpread', 'argumentsAndApply', 'restAndApply', - 'predefined' + 'predefined', ]; const bench = createBenchmark(main, { diff --git a/benchmark/misc/punycode.js b/benchmark/misc/punycode.js index c9eef1f7096fac..18023419709ee5 100644 --- a/benchmark/misc/punycode.js +++ b/benchmark/misc/punycode.js @@ -32,7 +32,7 @@ const bench = common.createBenchmark(main, { 'éire.icom.museum', 'איקו״ם.ישראל.museum', '日本.icom.museum', - 'الأردن.icom.museum' + 'الأردن.icom.museum', ] }); diff --git a/benchmark/misc/startup.js b/benchmark/misc/startup.js index c1c893b0011abd..da24ee65199077 100644 --- a/benchmark/misc/startup.js +++ b/benchmark/misc/startup.js @@ -60,7 +60,7 @@ function main({ dur, script, mode }) { throughput: 0 }; - setTimeout(function() { + setTimeout(() => { state.go = false; }, dur * 1000); diff --git a/benchmark/net/net-c2s-cork.js b/benchmark/net/net-c2s-cork.js index 55bb99f6f73d2b..38a0b17512e139 100644 --- a/benchmark/net/net-c2s-cork.js +++ b/benchmark/net/net-c2s-cork.js @@ -34,19 +34,19 @@ function main({ dur, len, type }) { const writer = new Writer(); // the actual benchmark. - const server = net.createServer(function(socket) { + const server = net.createServer((socket) => { socket.pipe(writer); }); - server.listen(PORT, function() { + server.listen(PORT, () => { const socket = net.connect(PORT); - socket.on('connect', function() { + socket.on('connect', () => { bench.start(); socket.on('drain', send); send(); - setTimeout(function() { + setTimeout(() => { const bytes = writer.received; const gbits = (bytes * 8) / (1024 * 1024 * 1024); bench.end(gbits); diff --git a/benchmark/net/net-c2s.js b/benchmark/net/net-c2s.js index dc2a5bc01523dd..2d6ac85f5d25b0 100644 --- a/benchmark/net/net-c2s.js +++ b/benchmark/net/net-c2s.js @@ -35,18 +35,18 @@ function main({ dur, len, type }) { const writer = new Writer(); // the actual benchmark. - const server = net.createServer(function(socket) { + const server = net.createServer((socket) => { socket.pipe(writer); }); - server.listen(PORT, function() { + server.listen(PORT, () => { const socket = net.connect(PORT); - socket.on('connect', function() { + socket.on('connect', () => { bench.start(); reader.pipe(socket); - setTimeout(function() { + setTimeout(() => { const bytes = writer.received; const gbits = (bytes * 8) / (1024 * 1024 * 1024); bench.end(gbits); diff --git a/benchmark/net/net-pipe.js b/benchmark/net/net-pipe.js index e02f1d3816ab5a..dc0b996dc389c5 100644 --- a/benchmark/net/net-pipe.js +++ b/benchmark/net/net-pipe.js @@ -35,19 +35,19 @@ function main({ dur, len, type }) { const writer = new Writer(); // the actual benchmark. - const server = net.createServer(function(socket) { + const server = net.createServer((socket) => { socket.pipe(socket); }); - server.listen(PORT, function() { + server.listen(PORT, () => { const socket = net.connect(PORT); - socket.on('connect', function() { + socket.on('connect', () => { bench.start(); reader.pipe(socket); socket.pipe(writer); - setTimeout(function() { + setTimeout(() => { // Multiply by 2 since we're sending it first one way // then then back again. const bytes = writer.received * 2; diff --git a/benchmark/net/net-s2c.js b/benchmark/net/net-s2c.js index 6ee5afa663aaca..bb0a3121b9e9e3 100644 --- a/benchmark/net/net-s2c.js +++ b/benchmark/net/net-s2c.js @@ -34,18 +34,18 @@ function main({ dur, len, type }) { const writer = new Writer(); // the actual benchmark. - const server = net.createServer(function(socket) { + const server = net.createServer((socket) => { reader.pipe(socket); }); - server.listen(PORT, function() { + server.listen(PORT, () => { const socket = net.connect(PORT); - socket.on('connect', function() { + socket.on('connect', () => { bench.start(); socket.pipe(writer); - setTimeout(function() { + setTimeout(() => { const bytes = writer.received; const gbits = (bytes * 8) / (1024 * 1024 * 1024); bench.end(gbits); diff --git a/benchmark/net/net-wrap-js-stream-passthrough.js b/benchmark/net/net-wrap-js-stream-passthrough.js index 74652225889bb0..abea4b573d320e 100644 --- a/benchmark/net/net-wrap-js-stream-passthrough.js +++ b/benchmark/net/net-wrap-js-stream-passthrough.js @@ -44,7 +44,7 @@ function main({ dur, len, type }) { reader.pipe(fakeSocket); fakeSocket.pipe(writer); - setTimeout(function() { + setTimeout(() => { const bytes = writer.received; const gbits = (bytes * 8) / (1024 * 1024 * 1024); bench.end(gbits); diff --git a/benchmark/net/tcp-raw-c2s.js b/benchmark/net/tcp-raw-c2s.js index 745a664e00acf9..849b3651681e7f 100644 --- a/benchmark/net/tcp-raw-c2s.js +++ b/benchmark/net/tcp-raw-c2s.js @@ -40,7 +40,7 @@ function main({ dur, len, type }) { bench.start(); var bytes = 0; - setTimeout(function() { + setTimeout(() => { // report in Gb/sec bench.end((bytes * 8) / (1024 * 1024 * 1024)); process.exit(0); diff --git a/benchmark/net/tcp-raw-pipe.js b/benchmark/net/tcp-raw-pipe.js index 65a7d05f4b8ce0..10c69fb8b2d4bf 100644 --- a/benchmark/net/tcp-raw-pipe.js +++ b/benchmark/net/tcp-raw-pipe.js @@ -104,7 +104,7 @@ function main({ dur, len, type }) { clientHandle.readStart(); - setTimeout(function() { + setTimeout(() => { // Multiply by 2 since we're sending it first one way // then then back again. bench.end(2 * (bytes * 8) / (1024 * 1024 * 1024)); diff --git a/benchmark/net/tcp-raw-s2c.js b/benchmark/net/tcp-raw-s2c.js index 4dd1ad6ee82e55..d34434a3d02e41 100644 --- a/benchmark/net/tcp-raw-s2c.js +++ b/benchmark/net/tcp-raw-s2c.js @@ -78,7 +78,7 @@ function main({ dur, len, type }) { if (err) { fail(err, 'write'); } else if (!writeReq.async) { - process.nextTick(function() { + process.nextTick(() => { afterWrite(0, clientHandle); }); } @@ -125,7 +125,7 @@ function main({ dur, len, type }) { // the meat of the benchmark is right here: bench.start(); - setTimeout(function() { + setTimeout(() => { // report in Gb/sec bench.end((bytes * 8) / (1024 * 1024 * 1024)); process.exit(0); diff --git a/benchmark/path/basename-posix.js b/benchmark/path/basename-posix.js index 20b734703f0746..024687cef0d234 100644 --- a/benchmark/path/basename-posix.js +++ b/benchmark/path/basename-posix.js @@ -13,7 +13,7 @@ const bench = common.createBenchmark(main, { 'foo/bar.', ['foo/bar.', '.'].join('|'), '/foo/bar/baz/asdf/quux.html', - ['/foo/bar/baz/asdf/quux.html', '.html'].join('|') + ['/foo/bar/baz/asdf/quux.html', '.html'].join('|'), ], n: [1e6] }); diff --git a/benchmark/path/basename-win32.js b/benchmark/path/basename-win32.js index 937dc6f6948c5d..a68bf0c12a8e42 100644 --- a/benchmark/path/basename-win32.js +++ b/benchmark/path/basename-win32.js @@ -13,7 +13,7 @@ const bench = common.createBenchmark(main, { 'foo\\bar.', ['foo\\bar.', '.'].join('|'), '\\foo\\bar\\baz\\asdf\\quux.html', - ['\\foo\\bar\\baz\\asdf\\quux.html', '.html'].join('|') + ['\\foo\\bar\\baz\\asdf\\quux.html', '.html'].join('|'), ], n: [1e6] }); diff --git a/benchmark/path/dirname-posix.js b/benchmark/path/dirname-posix.js index a045125f43c730..b99bb99b3b0de5 100644 --- a/benchmark/path/dirname-posix.js +++ b/benchmark/path/dirname-posix.js @@ -10,7 +10,7 @@ const bench = common.createBenchmark(main, { '/foo/bar', 'foo', 'foo/bar', - '/foo/bar/baz/asdf/quux' + '/foo/bar/baz/asdf/quux', ], n: [1e6] }); diff --git a/benchmark/path/dirname-win32.js b/benchmark/path/dirname-win32.js index f47abdd37910e2..551956efaf7795 100644 --- a/benchmark/path/dirname-win32.js +++ b/benchmark/path/dirname-win32.js @@ -10,7 +10,7 @@ const bench = common.createBenchmark(main, { 'C:\\foo\\bar', 'foo', 'foo\\bar', - 'D:\\foo\\bar\\baz\\asdf\\quux' + 'D:\\foo\\bar\\baz\\asdf\\quux', ], n: [1e6] }); diff --git a/benchmark/path/extname-posix.js b/benchmark/path/extname-posix.js index 3dde5e99005d72..1c7d9e94495c0a 100644 --- a/benchmark/path/extname-posix.js +++ b/benchmark/path/extname-posix.js @@ -13,7 +13,7 @@ const bench = common.createBenchmark(main, { 'foo/bar/..baz.quux', 'foo/bar/...baz.quux', '/foo/bar/baz/asdf/quux', - '/foo/bar/baz/asdf/quux.foobarbazasdfquux' + '/foo/bar/baz/asdf/quux.foobarbazasdfquux', ], n: [1e6] }); diff --git a/benchmark/path/extname-win32.js b/benchmark/path/extname-win32.js index 55602df34b4a24..4378f8119af3b3 100644 --- a/benchmark/path/extname-win32.js +++ b/benchmark/path/extname-win32.js @@ -13,7 +13,7 @@ const bench = common.createBenchmark(main, { 'foo\\bar\\..baz.quux', 'foo\\bar\\...baz.quux', 'D:\\foo\\bar\\baz\\asdf\\quux', - '\\foo\\bar\\baz\\asdf\\quux.foobarbazasdfquux' + '\\foo\\bar\\baz\\asdf\\quux.foobarbazasdfquux', ], n: [1e6] }); diff --git a/benchmark/path/format-posix.js b/benchmark/path/format-posix.js index aa92c06a4d5b2f..bae1ae1e2371db 100644 --- a/benchmark/path/format-posix.js +++ b/benchmark/path/format-posix.js @@ -4,7 +4,7 @@ const { posix } = require('path'); const bench = common.createBenchmark(main, { props: [ - ['/', '/home/user/dir', 'index.html', '.html', 'index'].join('|') + ['/', '/home/user/dir', 'index.html', '.html', 'index'].join('|'), ], n: [1e7] }); diff --git a/benchmark/path/format-win32.js b/benchmark/path/format-win32.js index 5921f95cf12064..efb3fcd2c80701 100644 --- a/benchmark/path/format-win32.js +++ b/benchmark/path/format-win32.js @@ -4,7 +4,7 @@ const { win32 } = require('path'); const bench = common.createBenchmark(main, { props: [ - ['C:\\', 'C:\\path\\dir', 'index.html', '.html', 'index'].join('|') + ['C:\\', 'C:\\path\\dir', 'index.html', '.html', 'index'].join('|'), ], n: [1e7] }); diff --git a/benchmark/path/isAbsolute-posix.js b/benchmark/path/isAbsolute-posix.js index 42994840487c68..96da0e01c640b3 100644 --- a/benchmark/path/isAbsolute-posix.js +++ b/benchmark/path/isAbsolute-posix.js @@ -8,7 +8,7 @@ const bench = common.createBenchmark(main, { '.', '/foo/bar', '/baz/..', - 'bar/baz' + 'bar/baz', ], n: [1e6] }); diff --git a/benchmark/path/isAbsolute-win32.js b/benchmark/path/isAbsolute-win32.js index 350e99d48b74a5..edb84e80776fd6 100644 --- a/benchmark/path/isAbsolute-win32.js +++ b/benchmark/path/isAbsolute-win32.js @@ -9,7 +9,7 @@ const bench = common.createBenchmark(main, { '//server', 'C:\\baz\\..', 'C:baz\\..', - 'bar\\baz' + 'bar\\baz', ], n: [1e6] }); diff --git a/benchmark/path/join-posix.js b/benchmark/path/join-posix.js index f06f74ad37fc46..2ba1a4299fcf8c 100644 --- a/benchmark/path/join-posix.js +++ b/benchmark/path/join-posix.js @@ -4,7 +4,7 @@ const { posix } = require('path'); const bench = common.createBenchmark(main, { paths: [ - ['/foo', 'bar', '', 'baz/asdf', 'quux', '..'].join('|') + ['/foo', 'bar', '', 'baz/asdf', 'quux', '..'].join('|'), ], n: [1e6] }); diff --git a/benchmark/path/join-win32.js b/benchmark/path/join-win32.js index 2fa29f8ebfd356..42449542aa31b6 100644 --- a/benchmark/path/join-win32.js +++ b/benchmark/path/join-win32.js @@ -4,7 +4,7 @@ const { win32 } = require('path'); const bench = common.createBenchmark(main, { paths: [ - ['C:\\foo', 'bar', '', 'baz\\asdf', 'quux', '..'].join('|') + ['C:\\foo', 'bar', '', 'baz\\asdf', 'quux', '..'].join('|'), ], n: [1e6] }); diff --git a/benchmark/path/makeLong-win32.js b/benchmark/path/makeLong-win32.js index 4314692eefab5e..f300f47cf53edd 100644 --- a/benchmark/path/makeLong-win32.js +++ b/benchmark/path/makeLong-win32.js @@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, { 'foo\\bar', 'C:\\foo', '\\\\foo\\bar', - '\\\\?\\foo' + '\\\\?\\foo', ], n: [1e6] }); diff --git a/benchmark/path/normalize-posix.js b/benchmark/path/normalize-posix.js index 84ac8d2c7c89d2..7b5c2b1cf9009e 100644 --- a/benchmark/path/normalize-posix.js +++ b/benchmark/path/normalize-posix.js @@ -9,7 +9,7 @@ const bench = common.createBenchmark(main, { '/../', '/foo', '/foo/bar', - '/foo/bar//baz/asdf/quux/..' + '/foo/bar//baz/asdf/quux/..', ], n: [1e6] }); diff --git a/benchmark/path/normalize-win32.js b/benchmark/path/normalize-win32.js index 9b983eb9686580..749523daa81832 100644 --- a/benchmark/path/normalize-win32.js +++ b/benchmark/path/normalize-win32.js @@ -9,7 +9,7 @@ const bench = common.createBenchmark(main, { 'C:\\..\\', 'C:\\foo', 'C:\\foo\\bar', - 'C:\\foo\\bar\\\\baz\\asdf\\quux\\..' + 'C:\\foo\\bar\\\\baz\\asdf\\quux\\..', ], n: [1e6] }); diff --git a/benchmark/path/parse-posix.js b/benchmark/path/parse-posix.js index dd1153d3c68b7e..00fdc6a3ad7c81 100644 --- a/benchmark/path/parse-posix.js +++ b/benchmark/path/parse-posix.js @@ -10,7 +10,7 @@ const bench = common.createBenchmark(main, { '/foo/bar.baz', 'foo/.bar.baz', 'foo/bar', - '/foo/bar/baz/asdf/.quux' + '/foo/bar/baz/asdf/.quux', ], n: [1e6] }); diff --git a/benchmark/path/parse-win32.js b/benchmark/path/parse-win32.js index 8c4f06272f4b05..5bcc150d1b70fb 100644 --- a/benchmark/path/parse-win32.js +++ b/benchmark/path/parse-win32.js @@ -11,7 +11,7 @@ const bench = common.createBenchmark(main, { 'E:\\foo\\bar.baz', 'foo\\.bar.baz', 'foo\\bar', - '\\foo\\bar\\baz\\asdf\\.quux' + '\\foo\\bar\\baz\\asdf\\.quux', ], n: [1e6] }); diff --git a/benchmark/path/relative-posix.js b/benchmark/path/relative-posix.js index 70a0e434d98313..caf1996135550a 100644 --- a/benchmark/path/relative-posix.js +++ b/benchmark/path/relative-posix.js @@ -10,7 +10,7 @@ const bench = common.createBenchmark(main, { ['/var', '/bin'].join('|'), ['/foo/bar/baz/quux', '/'].join('|'), ['/foo/bar/baz/quux', '/foo/bar/baz/quux'].join('|'), - ['/foo/bar/baz/quux', '/var/log'].join('|') + ['/foo/bar/baz/quux', '/var/log'].join('|'), ], n: [1e6] }); diff --git a/benchmark/path/relative-win32.js b/benchmark/path/relative-win32.js index 4a97e82e028a0c..81fd10b46c2246 100644 --- a/benchmark/path/relative-win32.js +++ b/benchmark/path/relative-win32.js @@ -8,7 +8,7 @@ const bench = common.createBenchmark(main, { ['C:\\', 'D:\\'].join('|'), ['C:\\foo\\bar\\baz', 'C:\\foo\\bar\\baz'].join('|'), ['C:\\foo\\BAR\\BAZ', 'C:\\foo\\bar\\baz'].join('|'), - ['C:\\foo\\bar\\baz\\quux', 'C:\\'].join('|') + ['C:\\foo\\bar\\baz\\quux', 'C:\\'].join('|'), ], n: [1e6] }); diff --git a/benchmark/path/resolve-posix.js b/benchmark/path/resolve-posix.js index 91f4c1da102a5c..14b7fd10962562 100644 --- a/benchmark/path/resolve-posix.js +++ b/benchmark/path/resolve-posix.js @@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, { '', ['', ''].join('|'), ['foo/bar', '/tmp/file/', '..', 'a/../subfile'].join('|'), - ['a/b/c/', '../../..'].join('|') + ['a/b/c/', '../../..'].join('|'), ], n: [1e6] }); diff --git a/benchmark/path/resolve-win32.js b/benchmark/path/resolve-win32.js index 1047da5184b528..83e10042b4a6b9 100644 --- a/benchmark/path/resolve-win32.js +++ b/benchmark/path/resolve-win32.js @@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, { '', ['', ''].join('|'), ['c:/ignore', 'd:\\a/b\\c/d', '\\e.exe'].join('|'), - ['c:/blah\\blah', 'd:/games', 'c:../a'].join('|') + ['c:/blah\\blah', 'd:/games', 'c:../a'].join('|'), ], n: [1e6] }); diff --git a/benchmark/querystring/querystring-unescapebuffer.js b/benchmark/querystring/querystring-unescapebuffer.js index 4f73ed024b11b1..39dd085eda938c 100644 --- a/benchmark/querystring/querystring-unescapebuffer.js +++ b/benchmark/querystring/querystring-unescapebuffer.js @@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, { 'there is nothing to unescape here', 'there%20are%20several%20spaces%20that%20need%20to%20be%20unescaped', 'there%2Qare%0-fake%escaped values in%%%%this%9Hstring', - '%20%21%22%23%24%25%26%27%28%29%2A%2B%2C%2D%2E%2F%30%31%32%33%34%35%36%37' + '%20%21%22%23%24%25%26%27%28%29%2A%2B%2C%2D%2E%2F%30%31%32%33%34%35%36%37', ], n: [10e6], }); diff --git a/benchmark/run.js b/benchmark/run.js index af2bd4d5c2bcec..25a60f2d8d966e 100644 --- a/benchmark/run.js +++ b/benchmark/run.js @@ -41,7 +41,7 @@ if (format === 'csv') { console.log(filename); } - child.on('message', function(data) { + child.on('message', (data) => { if (data.type !== 'report') { return; } @@ -64,7 +64,7 @@ if (format === 'csv') { } }); - child.once('close', function(code) { + child.once('close', (code) => { if (code) { process.exit(code); return; diff --git a/benchmark/scatter.js b/benchmark/scatter.js index 70c3e25bb9f2ad..62de1cd0c166dc 100644 --- a/benchmark/scatter.js +++ b/benchmark/scatter.js @@ -39,7 +39,7 @@ function csvEncodeValue(value) { (function recursive(i) { const child = fork(path.resolve(__dirname, filepath), cli.optional.set); - child.on('message', function(data) { + child.on('message', (data) => { if (data.type !== 'report') { return; } @@ -61,7 +61,7 @@ function csvEncodeValue(value) { console.log(`"${name}", ${confData}, ${data.rate}, ${data.time}`); }); - child.once('close', function(code) { + child.once('close', (code) => { if (code) { process.exit(code); return; diff --git a/benchmark/string_decoder/string-decoder-create.js b/benchmark/string_decoder/string-decoder-create.js index 386f99e7c0ee6f..fad727222e1870 100644 --- a/benchmark/string_decoder/string-decoder-create.js +++ b/benchmark/string_decoder/string-decoder-create.js @@ -4,7 +4,7 @@ const StringDecoder = require('string_decoder').StringDecoder; const bench = common.createBenchmark(main, { encoding: [ - 'ascii', 'utf8', 'utf-8', 'base64', 'ucs2', 'UTF-8', 'AscII', 'UTF-16LE' + 'ascii', 'utf8', 'utf-8', 'base64', 'ucs2', 'UTF-8', 'AscII', 'UTF-16LE', ], n: [25e6] }); diff --git a/benchmark/string_decoder/string-decoder.js b/benchmark/string_decoder/string-decoder.js index 95baa893bbbf94..0e34effbc7d964 100644 --- a/benchmark/string_decoder/string-decoder.js +++ b/benchmark/string_decoder/string-decoder.js @@ -54,7 +54,7 @@ function main({ encoding, inLen, chunkLen, n }) { } str = Buffer.concat([ str, - buf.slice(start % buf.length, end % buf.length) + buf.slice(start % buf.length, end % buf.length), ]); } } diff --git a/benchmark/timers/set-immediate-breadth-args.js b/benchmark/timers/set-immediate-breadth-args.js index 25147a5ea2a972..518ed90e58f476 100644 --- a/benchmark/timers/set-immediate-breadth-args.js +++ b/benchmark/timers/set-immediate-breadth-args.js @@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, { function main({ n }) { - process.on('exit', function() { + process.on('exit', () => { bench.end(n); }); diff --git a/benchmark/timers/set-immediate-breadth.js b/benchmark/timers/set-immediate-breadth.js index 44afe5aad9fbd3..87bf9ee2c39479 100644 --- a/benchmark/timers/set-immediate-breadth.js +++ b/benchmark/timers/set-immediate-breadth.js @@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, { function main({ n }) { - process.on('exit', function() { + process.on('exit', () => { bench.end(n); }); diff --git a/benchmark/timers/set-immediate-depth-args.js b/benchmark/timers/set-immediate-depth-args.js index 2b18fcfd6341f2..d8eb5c409a64e4 100644 --- a/benchmark/timers/set-immediate-depth-args.js +++ b/benchmark/timers/set-immediate-depth-args.js @@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, { function main({ n }) { - process.on('exit', function() { + process.on('exit', () => { bench.end(n); }); diff --git a/benchmark/tls/throughput.js b/benchmark/tls/throughput.js index 1ca52ad9496237..3c0c2d4ea18099 100644 --- a/benchmark/tls/throughput.js +++ b/benchmark/tls/throughput.js @@ -41,9 +41,9 @@ function main({ dur, type, size }) { server = tls.createServer(options, onConnection); var conn; - server.listen(common.PORT, function() { + server.listen(common.PORT, () => { const opt = { port: common.PORT, rejectUnauthorized: false }; - conn = tls.connect(opt, function() { + conn = tls.connect(opt, () => { setTimeout(done, dur * 1000); bench.start(); conn.on('drain', write); @@ -57,7 +57,7 @@ function main({ dur, type, size }) { var received = 0; function onConnection(conn) { - conn.on('data', function(chunk) { + conn.on('data', (chunk) => { received += chunk.length; }); } diff --git a/benchmark/tls/tls-connect.js b/benchmark/tls/tls-connect.js index fd7ea89b3b2c0a..470d536f87e6b2 100644 --- a/benchmark/tls/tls-connect.js +++ b/benchmark/tls/tls-connect.js @@ -46,9 +46,9 @@ function makeConnection() { port: common.PORT, rejectUnauthorized: false }; - var conn = tls.connect(options, function() { + var conn = tls.connect(options, () => { clientConn++; - conn.on('error', function(er) { + conn.on('error', (er) => { console.error('client error', er); throw er; }); diff --git a/benchmark/util/inspect.js b/benchmark/util/inspect.js index 9ba3020fd0e55b..fd6f6158cd671d 100644 --- a/benchmark/util/inspect.js +++ b/benchmark/util/inspect.js @@ -23,7 +23,7 @@ const bench = common.createBenchmark(main, { 'Array', 'TypedArray', 'TypedArray_extra', - 'Number' + 'Number', ], option: Object.keys(opts) }); diff --git a/benchmark/util/normalize-encoding.js b/benchmark/util/normalize-encoding.js index 47c8bce277cf3d..464bda52f35c44 100644 --- a/benchmark/util/normalize-encoding.js +++ b/benchmark/util/normalize-encoding.js @@ -16,7 +16,7 @@ const inputs = [ '', 'utf8', 'utf-8', 'UTF-8', 'UTF8', 'Utf8', 'ucs2', 'UCS2', 'utf16le', 'UTF16LE', 'binary', 'BINARY', 'latin1', 'base64', 'BASE64', - 'hex', 'HEX', 'foo', 'undefined' + 'hex', 'HEX', 'foo', 'undefined', ]; const bench = common.createBenchmark(main, { diff --git a/benchmark/v8/get-stats.js b/benchmark/v8/get-stats.js index 84a0655f5db4fa..aa1f0516811983 100644 --- a/benchmark/v8/get-stats.js +++ b/benchmark/v8/get-stats.js @@ -6,7 +6,7 @@ const v8 = require('v8'); const bench = common.createBenchmark(main, { method: [ 'getHeapStatistics', - 'getHeapSpaceStatistics' + 'getHeapSpaceStatistics', ], n: [1e6] }); diff --git a/benchmark/zlib/creation.js b/benchmark/zlib/creation.js index f23759fa0ebf38..30e6afe6b4355f 100644 --- a/benchmark/zlib/creation.js +++ b/benchmark/zlib/creation.js @@ -5,7 +5,7 @@ const zlib = require('zlib'); const bench = common.createBenchmark(main, { type: [ 'Deflate', 'DeflateRaw', 'Inflate', 'InflateRaw', 'Gzip', 'Gunzip', 'Unzip', - 'BrotliCompress', 'BrotliDecompress' + 'BrotliCompress', 'BrotliDecompress', ], options: ['true', 'false'], n: [5e5]