Skip to content

Commit 91e96d8

Browse files
committed
lib,src: fix consistent spacing inside braces
PR-URL: #14162 Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 9049f09 commit 91e96d8

File tree

261 files changed

+1000
-964
lines changed

Some content is hidden

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

261 files changed

+1000
-964
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
@@ -146,7 +146,7 @@ Console.prototype.error = Console.prototype.warn;
146146

147147

148148
Console.prototype.dir = function dir(object, options) {
149-
options = Object.assign({customInspect: false}, options);
149+
options = Object.assign({ customInspect: false }, options);
150150
write(this._ignoreErrors,
151151
this._stdout,
152152
util.inspect(object, options),

lib/dgram.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ Socket.prototype.send = function(buffer,
411411
this._healthCheck();
412412

413413
if (this._bindState === BIND_STATE_UNBOUND)
414-
this.bind({port: 0, exclusive: true}, null);
414+
this.bind({ port: 0, exclusive: true }, null);
415415

416416
if (list.length === 0)
417417
list.push(Buffer.alloc(0));

lib/dns.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ function lookup(hostname, options, callback) {
169169
if (matchedFamily) {
170170
if (all) {
171171
process.nextTick(
172-
callback, null, [{address: hostname, family: matchedFamily}]);
172+
callback, null, [{ address: hostname, family: matchedFamily }]);
173173
} else {
174174
process.nextTick(callback, null, hostname, matchedFamily);
175175
}

lib/fs.js

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

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

263263
function handleError(val, callback) {

lib/inspector.js

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

lib/internal/bootstrap_node.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@
476476
// wrap it
477477
source = Module.wrap(source);
478478
// compile the script, this will throw if it fails
479-
new vm.Script(source, {displayErrors: true, filename});
479+
new vm.Script(source, { displayErrors: true, filename });
480480
}
481481

482482
// 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
@@ -109,7 +109,7 @@ const handleConversion = {
109109
},
110110

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

115115
// if the socket was created by net.Server we will track the socket
@@ -582,7 +582,7 @@ function setupChannel(target, channel) {
582582
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'options', 'Object');
583583
}
584584

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

587587
if (this.connected) {
588588
return this._send(message, handle, options, callback);
@@ -604,7 +604,7 @@ function setupChannel(target, channel) {
604604

605605
// Support legacy function signature
606606
if (typeof options === 'boolean') {
607-
options = {swallowErrors: options};
607+
options = { swallowErrors: options };
608608
}
609609

610610
// package messages with a handle object
@@ -838,7 +838,7 @@ function _validateStdio(stdio, sync) {
838838
}
839839

840840
if (stdio === 'ignore') {
841-
acc.push({type: 'ignore'});
841+
acc.push({ type: 'ignore' });
842842
} else if (stdio === 'pipe' || typeof stdio === 'number' && stdio < 0) {
843843
var a = {
844844
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
@@ -102,4 +102,4 @@ class SocketListReceive extends EventEmitter {
102102
}
103103
}
104104

105-
module.exports = {SocketListSend, SocketListReceive};
105+
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
@@ -683,7 +683,7 @@ Interface.prototype._getDisplayPos = function(str) {
683683
}
684684
var cols = offset % col;
685685
var rows = row + (offset - cols) / col;
686-
return {cols: cols, rows: rows};
686+
return { cols: cols, rows: rows };
687687
};
688688

689689

@@ -702,7 +702,7 @@ Interface.prototype._getCursorPos = function() {
702702
rows++;
703703
cols = 0;
704704
}
705-
return {cols: cols, rows: rows};
705+
return { cols: cols, rows: rows };
706706
};
707707

708708

lib/repl.js

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

10701070
REPLServer.prototype.defineCommand = function(keyword, cmd) {
10711071
if (typeof cmd === 'function') {
1072-
cmd = {action: cmd};
1072+
cmd = { action: cmd };
10731073
} else if (typeof cmd.action !== 'function') {
10741074
throw new Error('Bad argument, "action" command must be a function');
10751075
}

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)