Skip to content

Commit bb29405

Browse files
sebdeckersrefack
authored andcommitted
lib,src: fix consistent spacing inside braces
PR-URL: #14162 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 4f87522 commit bb29405

File tree

293 files changed

+1108
-1051
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

293 files changed

+1108
-1051
lines changed

benchmark/_test-double-benchmarker.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
const http = require('http');
44

55
http.get(process.env.path, function() {
6-
console.log(JSON.stringify({throughput: 1}));
6+
console.log(JSON.stringify({ throughput: 1 }));
77
});

benchmark/crypto/aes-gcm-throughput.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
var common = require('../common.js');
33
var crypto = require('crypto');
4-
var keylen = {'aes-128-gcm': 16, 'aes-192-gcm': 24, 'aes-256-gcm': 32};
4+
var keylen = { 'aes-128-gcm': 16, 'aes-192-gcm': 24, 'aes-256-gcm': 32 };
55
var bench = common.createBenchmark(main, {
66
n: [500],
77
cipher: ['aes-128-gcm', 'aes-192-gcm', 'aes-256-gcm'],

benchmark/events/ee-add-remove.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
var common = require('../common.js');
33
var events = require('events');
44

5-
var bench = common.createBenchmark(main, {n: [25e4]});
5+
var bench = common.createBenchmark(main, { n: [25e4] });
66

77
function main(conf) {
88
var n = conf.n | 0;

benchmark/events/ee-emit-multi-args.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
var common = require('../common.js');
33
var EventEmitter = require('events').EventEmitter;
44

5-
var bench = common.createBenchmark(main, {n: [2e6]});
5+
var bench = common.createBenchmark(main, { n: [2e6] });
66

77
function main(conf) {
88
var n = conf.n | 0;

benchmark/events/ee-emit.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
var common = require('../common.js');
33
var EventEmitter = require('events').EventEmitter;
44

5-
var bench = common.createBenchmark(main, {n: [2e6]});
5+
var bench = common.createBenchmark(main, { n: [2e6] });
66

77
function main(conf) {
88
var n = conf.n | 0;

benchmark/events/ee-listener-count-on-prototype.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
var common = require('../common.js');
33
var EventEmitter = require('events').EventEmitter;
44

5-
var bench = common.createBenchmark(main, {n: [5e7]});
5+
var bench = common.createBenchmark(main, { n: [5e7] });
66

77
function main(conf) {
88
var n = conf.n | 0;

benchmark/events/ee-listeners-many.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
var common = require('../common.js');
33
var EventEmitter = require('events').EventEmitter;
44

5-
var bench = common.createBenchmark(main, {n: [5e6]});
5+
var bench = common.createBenchmark(main, { n: [5e6] });
66

77
function main(conf) {
88
var n = conf.n | 0;

benchmark/events/ee-listeners.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
var common = require('../common.js');
33
var EventEmitter = require('events').EventEmitter;
44

5-
var bench = common.createBenchmark(main, {n: [5e6]});
5+
var bench = common.createBenchmark(main, { n: [5e6] });
66

77
function main(conf) {
88
var n = conf.n | 0;

benchmark/events/ee-once.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
var common = require('../common.js');
33
var EventEmitter = require('events').EventEmitter;
44

5-
var bench = common.createBenchmark(main, {n: [2e7]});
5+
var bench = common.createBenchmark(main, { n: [2e7] });
66

77
function main(conf) {
88
var n = conf.n | 0;

benchmark/url/url-format.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ const common = require('../common.js');
33
const url = require('url');
44

55
const inputs = {
6-
slashes: {slashes: true, host: 'localhost'},
7-
file: {protocol: 'file:', pathname: '/foo'},
6+
slashes: { slashes: true, host: 'localhost' },
7+
file: { protocol: 'file:', pathname: '/foo' },
88
};
99

1010
const bench = common.createBenchmark(main, {

benchmark/util/format.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const bench = common.createBenchmark(main, {
1717
const inputs = {
1818
'string': ['Hello, my name is %s', 'fred'],
1919
'number': ['Hi, I was born in %d', 1942],
20-
'object': ['An error occurred %j', {msg: 'This is an error', code: 'ERR'}],
20+
'object': ['An error occurred %j', { msg: 'This is an error', code: 'ERR' }],
2121
'unknown': ['hello %a', 'test'],
2222
'no-replace': [1, 2]
2323
};

benchmark/util/inspect-proxy.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ const bench = common.createBenchmark(main, {
1010

1111
function twoDifferentProxies(n) {
1212
// This one should be slower because we're looking up multiple proxies.
13-
const proxyA = new Proxy({}, {get: () => {}});
14-
const proxyB = new Proxy({}, {get: () => {}});
13+
const proxyA = new Proxy({}, { get: () => {} });
14+
const proxyB = new Proxy({}, { get: () => {} });
1515
bench.start();
1616
for (var i = 0; i < n; i += 1)
17-
util.inspect({a: proxyA, b: proxyB}, {showProxy: true});
17+
util.inspect({ a: proxyA, b: proxyB }, { showProxy: true });
1818
bench.end(n);
1919
}
2020

2121
function oneProxy(n) {
2222
// This one should be a bit faster because of the internal caching.
23-
const proxy = new Proxy({}, {get: () => {}});
23+
const proxy = new Proxy({}, { get: () => {} });
2424
bench.start();
2525
for (var i = 0; i < n; i += 1)
26-
util.inspect({a: proxy, b: proxy}, {showProxy: true});
26+
util.inspect({ a: proxy, b: proxy }, { showProxy: true });
2727
bench.end(n);
2828
}
2929

benchmark/util/inspect.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ var util = require('util');
33

44
var common = require('../common.js');
55

6-
var bench = common.createBenchmark(main, {n: [5e6]});
6+
var bench = common.createBenchmark(main, { n: [5e6] });
77

88
function main(conf) {
99
var n = conf.n | 0;
1010

1111
bench.start();
1212
for (var i = 0; i < n; i += 1) {
13-
util.inspect({a: 'a', b: 'b', c: 'c', d: 'd'});
13+
util.inspect({ a: 'a', b: 'b', c: 'c', d: 'd' });
1414
}
1515
bench.end(n);
1616
}

benchmark/vm/run-in-context.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const vm = require('vm');
1212

1313
function main(conf) {
1414
const n = +conf.n;
15-
const options = conf.breakOnSigint ? {breakOnSigint: true} : {};
15+
const options = conf.breakOnSigint ? { breakOnSigint: true } : {};
1616
const withSigintListener = !!conf.withSigintListener;
1717

1818
process.removeAllListeners('SIGINT');

benchmark/vm/run-in-this-context.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const vm = require('vm');
1212

1313
function main(conf) {
1414
const n = +conf.n;
15-
const options = conf.breakOnSigint ? {breakOnSigint: true} : {};
15+
const options = conf.breakOnSigint ? { breakOnSigint: true } : {};
1616
const withSigintListener = !!conf.withSigintListener;
1717

1818
process.removeAllListeners('SIGINT');

lib/console.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Console.prototype.error = Console.prototype.warn;
124124

125125

126126
Console.prototype.dir = function dir(object, options) {
127-
options = Object.assign({customInspect: false}, options);
127+
options = Object.assign({ customInspect: false }, options);
128128
write(this._ignoreErrors,
129129
this._stdout,
130130
`${util.inspect(object, options)}\n`,

lib/dgram.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ Socket.prototype.send = function(buffer,
408408
this._healthCheck();
409409

410410
if (this._bindState === BIND_STATE_UNBOUND)
411-
this.bind({port: 0, exclusive: true}, null);
411+
this.bind({ port: 0, exclusive: true }, null);
412412

413413
if (list.length === 0)
414414
list.push(Buffer.alloc(0));

lib/dns.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ function lookup(hostname, options, callback) {
164164
if (matchedFamily) {
165165
if (all) {
166166
process.nextTick(
167-
callback, null, [{address: hostname, family: matchedFamily}]);
167+
callback, null, [{ address: hostname, family: matchedFamily }]);
168168
} else {
169169
process.nextTick(callback, null, hostname, matchedFamily);
170170
}

lib/fs.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,10 @@ function statsFromValues() {
253253

254254
// Don't allow mode to accidentally be overwritten.
255255
Object.defineProperties(fs, {
256-
F_OK: {enumerable: true, value: constants.F_OK || 0},
257-
R_OK: {enumerable: true, value: constants.R_OK || 0},
258-
W_OK: {enumerable: true, value: constants.W_OK || 0},
259-
X_OK: {enumerable: true, value: constants.X_OK || 0},
256+
F_OK: { enumerable: true, value: constants.F_OK || 0 },
257+
R_OK: { enumerable: true, value: constants.R_OK || 0 },
258+
W_OK: { enumerable: true, value: constants.W_OK || 0 },
259+
X_OK: { enumerable: true, value: constants.X_OK || 0 },
260260
});
261261

262262
function handleError(val, callback) {

lib/inspector.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class Session extends EventEmitter {
6262
throw new Error('Session is not connected');
6363
}
6464
const id = this[nextIdSymbol]++;
65-
const message = {id, method};
65+
const message = { id, method };
6666
if (params) {
6767
message['params'] = params;
6868
}

lib/internal/bootstrap_node.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@
454454
// wrap it
455455
source = Module.wrap(source);
456456
// compile the script, this will throw if it fails
457-
new vm.Script(source, {displayErrors: true, filename});
457+
new vm.Script(source, { displayErrors: true, filename });
458458
}
459459

460460
// Below you find a minimal module system, which is used to load the node

lib/internal/child_process.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const handleConversion = {
110110
},
111111

112112
got: function(message, handle, emit) {
113-
var socket = new net.Socket({handle: handle});
113+
var socket = new net.Socket({ handle: handle });
114114
socket.readable = socket.writable = true;
115115

116116
// if the socket was created by net.Server we will track the socket
@@ -584,7 +584,7 @@ function setupChannel(target, channel) {
584584
options);
585585
}
586586

587-
options = Object.assign({swallowErrors: false}, options);
587+
options = Object.assign({ swallowErrors: false }, options);
588588

589589
if (this.connected) {
590590
return this._send(message, handle, options, callback);
@@ -606,7 +606,7 @@ function setupChannel(target, channel) {
606606

607607
// Support legacy function signature
608608
if (typeof options === 'boolean') {
609-
options = {swallowErrors: options};
609+
options = { swallowErrors: options };
610610
}
611611

612612
// package messages with a handle object
@@ -840,7 +840,7 @@ function _validateStdio(stdio, sync) {
840840
}
841841

842842
if (stdio === 'ignore') {
843-
acc.push({type: 'ignore'});
843+
acc.push({ type: 'ignore' });
844844
} else if (stdio === 'pipe' || typeof stdio === 'number' && stdio < 0) {
845845
var a = {
846846
type: 'pipe',

lib/internal/cluster/master.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const cluster = new EventEmitter();
1212
const intercom = new EventEmitter();
1313
const SCHED_NONE = 1;
1414
const SCHED_RR = 2;
15-
const {isLegalPort} = require('internal/net');
15+
const { isLegalPort } = require('internal/net');
1616

1717
module.exports = cluster;
1818

lib/internal/socket_list.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,4 @@ class SocketListReceive extends EventEmitter {
104104
}
105105
}
106106

107-
module.exports = {SocketListSend, SocketListReceive};
107+
module.exports = { SocketListSend, SocketListReceive };

lib/internal/util.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ function createClassWrapper(type) {
150150
}
151151
// Mask the wrapper function name and length values
152152
Object.defineProperties(fn, {
153-
name: {value: type.name},
154-
length: {value: type.length}
153+
name: { value: type.name },
154+
length: { value: type.length }
155155
});
156156
Object.setPrototypeOf(fn, type);
157157
fn.prototype = type.prototype;

lib/readline.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ Interface.prototype._getDisplayPos = function(str) {
692692
}
693693
var cols = offset % col;
694694
var rows = row + (offset - cols) / col;
695-
return {cols: cols, rows: rows};
695+
return { cols: cols, rows: rows };
696696
};
697697

698698

@@ -711,7 +711,7 @@ Interface.prototype._getCursorPos = function() {
711711
rows++;
712712
cols = 0;
713713
}
714-
return {cols: cols, rows: rows};
714+
return { cols: cols, rows: rows };
715715
};
716716

717717

lib/repl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ REPLServer.prototype.parseREPLKeyword = function(keyword, rest) {
10551055

10561056
REPLServer.prototype.defineCommand = function(keyword, cmd) {
10571057
if (typeof cmd === 'function') {
1058-
cmd = {action: cmd};
1058+
cmd = { action: cmd };
10591059
} else if (typeof cmd.action !== 'function') {
10601060
throw new errors.TypeError('ERR_INVALID_ARG_TYPE',
10611061
'action', 'function', cmd.action);

test/addons-napi/test_make_callback_recurse/test.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ function checkDomains() {
101101
const d2 = domain.create();
102102
const d3 = domain.create();
103103

104-
makeCallback({domain: d1}, common.mustCall(function() {
104+
makeCallback({ domain: d1 }, common.mustCall(function() {
105105
assert.strictEqual(d1, process.domain);
106-
makeCallback({domain: d2}, common.mustCall(function() {
106+
makeCallback({ domain: d2 }, common.mustCall(function() {
107107
assert.strictEqual(d2, process.domain);
108-
makeCallback({domain: d3}, common.mustCall(function() {
108+
makeCallback({ domain: d3 }, common.mustCall(function() {
109109
assert.strictEqual(d3, process.domain);
110110
}));
111111
assert.strictEqual(d2, process.domain);
@@ -119,11 +119,11 @@ function checkDomains() {
119119
const d2 = domain.create();
120120
const d3 = domain.create();
121121

122-
makeCallback({domain: d1}, common.mustCall(function() {
122+
makeCallback({ domain: d1 }, common.mustCall(function() {
123123
assert.strictEqual(d1, process.domain);
124-
makeCallback({domain: d2}, common.mustCall(function() {
124+
makeCallback({ domain: d2 }, common.mustCall(function() {
125125
assert.strictEqual(d2, process.domain);
126-
makeCallback({domain: d3}, common.mustCall(function() {
126+
makeCallback({ domain: d3 }, common.mustCall(function() {
127127
assert.strictEqual(d3, process.domain);
128128
}));
129129
assert.strictEqual(d2, process.domain);
@@ -139,7 +139,7 @@ function checkDomains() {
139139
d.on('error', common.mustCall(function(e) {
140140
assert.strictEqual(e.message, `throw from domain ${id}`);
141141
}));
142-
makeCallback({domain: d}, function() {
142+
makeCallback({ domain: d }, function() {
143143
throw new Error(`throw from domain ${id}`);
144144
});
145145
throw new Error('UNREACHABLE');

test/addons-napi/test_object/test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ assert.strictEqual(newObject.test_string, 'test string');
9292
z: 10
9393
};
9494

95-
assert.deepStrictEqual(test_object.Inflate(cube), {x: 11, y: 11, z: 11});
96-
assert.deepStrictEqual(test_object.Inflate(cube), {x: 12, y: 12, z: 12});
97-
assert.deepStrictEqual(test_object.Inflate(cube), {x: 13, y: 13, z: 13});
95+
assert.deepStrictEqual(test_object.Inflate(cube), { x: 11, y: 11, z: 11 });
96+
assert.deepStrictEqual(test_object.Inflate(cube), { x: 12, y: 12, z: 12 });
97+
assert.deepStrictEqual(test_object.Inflate(cube), { x: 13, y: 13, z: 13 });
9898
cube.t = 13;
9999
assert.deepStrictEqual(
100-
test_object.Inflate(cube), {x: 14, y: 14, z: 14, t: 14});
100+
test_object.Inflate(cube), { x: 14, y: 14, z: 14, t: 14 });
101101

102102
const sym1 = Symbol('1');
103103
const sym2 = Symbol('2');

0 commit comments

Comments
 (0)