Skip to content

Commit

Permalink
lib,src: fix consistent spacing inside braces
Browse files Browse the repository at this point in the history
PR-URL: nodejs#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]>
  • Loading branch information
sebdeckers authored and refack committed Jul 21, 2017
1 parent 4f87522 commit bb29405
Show file tree
Hide file tree
Showing 293 changed files with 1,108 additions and 1,051 deletions.
2 changes: 1 addition & 1 deletion benchmark/_test-double-benchmarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
const http = require('http');

http.get(process.env.path, function() {
console.log(JSON.stringify({throughput: 1}));
console.log(JSON.stringify({ throughput: 1 }));
});
2 changes: 1 addition & 1 deletion benchmark/crypto/aes-gcm-throughput.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
var common = require('../common.js');
var crypto = require('crypto');
var keylen = {'aes-128-gcm': 16, 'aes-192-gcm': 24, 'aes-256-gcm': 32};
var keylen = { 'aes-128-gcm': 16, 'aes-192-gcm': 24, 'aes-256-gcm': 32 };
var bench = common.createBenchmark(main, {
n: [500],
cipher: ['aes-128-gcm', 'aes-192-gcm', 'aes-256-gcm'],
Expand Down
2 changes: 1 addition & 1 deletion benchmark/events/ee-add-remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var common = require('../common.js');
var events = require('events');

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

function main(conf) {
var n = conf.n | 0;
Expand Down
2 changes: 1 addition & 1 deletion benchmark/events/ee-emit-multi-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var common = require('../common.js');
var EventEmitter = require('events').EventEmitter;

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

function main(conf) {
var n = conf.n | 0;
Expand Down
2 changes: 1 addition & 1 deletion benchmark/events/ee-emit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var common = require('../common.js');
var EventEmitter = require('events').EventEmitter;

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

function main(conf) {
var n = conf.n | 0;
Expand Down
2 changes: 1 addition & 1 deletion benchmark/events/ee-listener-count-on-prototype.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var common = require('../common.js');
var EventEmitter = require('events').EventEmitter;

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

function main(conf) {
var n = conf.n | 0;
Expand Down
2 changes: 1 addition & 1 deletion benchmark/events/ee-listeners-many.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var common = require('../common.js');
var EventEmitter = require('events').EventEmitter;

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

function main(conf) {
var n = conf.n | 0;
Expand Down
2 changes: 1 addition & 1 deletion benchmark/events/ee-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var common = require('../common.js');
var EventEmitter = require('events').EventEmitter;

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

function main(conf) {
var n = conf.n | 0;
Expand Down
2 changes: 1 addition & 1 deletion benchmark/events/ee-once.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var common = require('../common.js');
var EventEmitter = require('events').EventEmitter;

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

function main(conf) {
var n = conf.n | 0;
Expand Down
4 changes: 2 additions & 2 deletions benchmark/url/url-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const common = require('../common.js');
const url = require('url');

const inputs = {
slashes: {slashes: true, host: 'localhost'},
file: {protocol: 'file:', pathname: '/foo'},
slashes: { slashes: true, host: 'localhost' },
file: { protocol: 'file:', pathname: '/foo' },
};

const bench = common.createBenchmark(main, {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/util/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const bench = common.createBenchmark(main, {
const inputs = {
'string': ['Hello, my name is %s', 'fred'],
'number': ['Hi, I was born in %d', 1942],
'object': ['An error occurred %j', {msg: 'This is an error', code: 'ERR'}],
'object': ['An error occurred %j', { msg: 'This is an error', code: 'ERR' }],
'unknown': ['hello %a', 'test'],
'no-replace': [1, 2]
};
Expand Down
10 changes: 5 additions & 5 deletions benchmark/util/inspect-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ const bench = common.createBenchmark(main, {

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

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

Expand Down
4 changes: 2 additions & 2 deletions benchmark/util/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ var util = require('util');

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

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

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

bench.start();
for (var i = 0; i < n; i += 1) {
util.inspect({a: 'a', b: 'b', c: 'c', d: 'd'});
util.inspect({ a: 'a', b: 'b', c: 'c', d: 'd' });
}
bench.end(n);
}
2 changes: 1 addition & 1 deletion benchmark/vm/run-in-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const vm = require('vm');

function main(conf) {
const n = +conf.n;
const options = conf.breakOnSigint ? {breakOnSigint: true} : {};
const options = conf.breakOnSigint ? { breakOnSigint: true } : {};
const withSigintListener = !!conf.withSigintListener;

process.removeAllListeners('SIGINT');
Expand Down
2 changes: 1 addition & 1 deletion benchmark/vm/run-in-this-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const vm = require('vm');

function main(conf) {
const n = +conf.n;
const options = conf.breakOnSigint ? {breakOnSigint: true} : {};
const options = conf.breakOnSigint ? { breakOnSigint: true } : {};
const withSigintListener = !!conf.withSigintListener;

process.removeAllListeners('SIGINT');
Expand Down
2 changes: 1 addition & 1 deletion lib/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Console.prototype.error = Console.prototype.warn;


Console.prototype.dir = function dir(object, options) {
options = Object.assign({customInspect: false}, options);
options = Object.assign({ customInspect: false }, options);
write(this._ignoreErrors,
this._stdout,
`${util.inspect(object, options)}\n`,
Expand Down
2 changes: 1 addition & 1 deletion lib/dgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ Socket.prototype.send = function(buffer,
this._healthCheck();

if (this._bindState === BIND_STATE_UNBOUND)
this.bind({port: 0, exclusive: true}, null);
this.bind({ port: 0, exclusive: true }, null);

if (list.length === 0)
list.push(Buffer.alloc(0));
Expand Down
2 changes: 1 addition & 1 deletion lib/dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ function lookup(hostname, options, callback) {
if (matchedFamily) {
if (all) {
process.nextTick(
callback, null, [{address: hostname, family: matchedFamily}]);
callback, null, [{ address: hostname, family: matchedFamily }]);
} else {
process.nextTick(callback, null, hostname, matchedFamily);
}
Expand Down
8 changes: 4 additions & 4 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,10 @@ function statsFromValues() {

// Don't allow mode to accidentally be overwritten.
Object.defineProperties(fs, {
F_OK: {enumerable: true, value: constants.F_OK || 0},
R_OK: {enumerable: true, value: constants.R_OK || 0},
W_OK: {enumerable: true, value: constants.W_OK || 0},
X_OK: {enumerable: true, value: constants.X_OK || 0},
F_OK: { enumerable: true, value: constants.F_OK || 0 },
R_OK: { enumerable: true, value: constants.R_OK || 0 },
W_OK: { enumerable: true, value: constants.W_OK || 0 },
X_OK: { enumerable: true, value: constants.X_OK || 0 },
});

function handleError(val, callback) {
Expand Down
2 changes: 1 addition & 1 deletion lib/inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Session extends EventEmitter {
throw new Error('Session is not connected');
}
const id = this[nextIdSymbol]++;
const message = {id, method};
const message = { id, method };
if (params) {
message['params'] = params;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/bootstrap_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@
// wrap it
source = Module.wrap(source);
// compile the script, this will throw if it fails
new vm.Script(source, {displayErrors: true, filename});
new vm.Script(source, { displayErrors: true, filename });
}

// Below you find a minimal module system, which is used to load the node
Expand Down
8 changes: 4 additions & 4 deletions lib/internal/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const handleConversion = {
},

got: function(message, handle, emit) {
var socket = new net.Socket({handle: handle});
var socket = new net.Socket({ handle: handle });
socket.readable = socket.writable = true;

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

options = Object.assign({swallowErrors: false}, options);
options = Object.assign({ swallowErrors: false }, options);

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

// Support legacy function signature
if (typeof options === 'boolean') {
options = {swallowErrors: options};
options = { swallowErrors: options };
}

// package messages with a handle object
Expand Down Expand Up @@ -840,7 +840,7 @@ function _validateStdio(stdio, sync) {
}

if (stdio === 'ignore') {
acc.push({type: 'ignore'});
acc.push({ type: 'ignore' });
} else if (stdio === 'pipe' || typeof stdio === 'number' && stdio < 0) {
var a = {
type: 'pipe',
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/cluster/master.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const cluster = new EventEmitter();
const intercom = new EventEmitter();
const SCHED_NONE = 1;
const SCHED_RR = 2;
const {isLegalPort} = require('internal/net');
const { isLegalPort } = require('internal/net');

module.exports = cluster;

Expand Down
2 changes: 1 addition & 1 deletion lib/internal/socket_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ class SocketListReceive extends EventEmitter {
}
}

module.exports = {SocketListSend, SocketListReceive};
module.exports = { SocketListSend, SocketListReceive };
4 changes: 2 additions & 2 deletions lib/internal/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ function createClassWrapper(type) {
}
// Mask the wrapper function name and length values
Object.defineProperties(fn, {
name: {value: type.name},
length: {value: type.length}
name: { value: type.name },
length: { value: type.length }
});
Object.setPrototypeOf(fn, type);
fn.prototype = type.prototype;
Expand Down
4 changes: 2 additions & 2 deletions lib/readline.js
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ Interface.prototype._getDisplayPos = function(str) {
}
var cols = offset % col;
var rows = row + (offset - cols) / col;
return {cols: cols, rows: rows};
return { cols: cols, rows: rows };
};


Expand All @@ -711,7 +711,7 @@ Interface.prototype._getCursorPos = function() {
rows++;
cols = 0;
}
return {cols: cols, rows: rows};
return { cols: cols, rows: rows };
};


Expand Down
2 changes: 1 addition & 1 deletion lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ REPLServer.prototype.parseREPLKeyword = function(keyword, rest) {

REPLServer.prototype.defineCommand = function(keyword, cmd) {
if (typeof cmd === 'function') {
cmd = {action: cmd};
cmd = { action: cmd };
} else if (typeof cmd.action !== 'function') {
throw new errors.TypeError('ERR_INVALID_ARG_TYPE',
'action', 'function', cmd.action);
Expand Down
14 changes: 7 additions & 7 deletions test/addons-napi/test_make_callback_recurse/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ function checkDomains() {
const d2 = domain.create();
const d3 = domain.create();

makeCallback({domain: d1}, common.mustCall(function() {
makeCallback({ domain: d1 }, common.mustCall(function() {
assert.strictEqual(d1, process.domain);
makeCallback({domain: d2}, common.mustCall(function() {
makeCallback({ domain: d2 }, common.mustCall(function() {
assert.strictEqual(d2, process.domain);
makeCallback({domain: d3}, common.mustCall(function() {
makeCallback({ domain: d3 }, common.mustCall(function() {
assert.strictEqual(d3, process.domain);
}));
assert.strictEqual(d2, process.domain);
Expand All @@ -119,11 +119,11 @@ function checkDomains() {
const d2 = domain.create();
const d3 = domain.create();

makeCallback({domain: d1}, common.mustCall(function() {
makeCallback({ domain: d1 }, common.mustCall(function() {
assert.strictEqual(d1, process.domain);
makeCallback({domain: d2}, common.mustCall(function() {
makeCallback({ domain: d2 }, common.mustCall(function() {
assert.strictEqual(d2, process.domain);
makeCallback({domain: d3}, common.mustCall(function() {
makeCallback({ domain: d3 }, common.mustCall(function() {
assert.strictEqual(d3, process.domain);
}));
assert.strictEqual(d2, process.domain);
Expand All @@ -139,7 +139,7 @@ function checkDomains() {
d.on('error', common.mustCall(function(e) {
assert.strictEqual(e.message, `throw from domain ${id}`);
}));
makeCallback({domain: d}, function() {
makeCallback({ domain: d }, function() {
throw new Error(`throw from domain ${id}`);
});
throw new Error('UNREACHABLE');
Expand Down
8 changes: 4 additions & 4 deletions test/addons-napi/test_object/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ assert.strictEqual(newObject.test_string, 'test string');
z: 10
};

assert.deepStrictEqual(test_object.Inflate(cube), {x: 11, y: 11, z: 11});
assert.deepStrictEqual(test_object.Inflate(cube), {x: 12, y: 12, z: 12});
assert.deepStrictEqual(test_object.Inflate(cube), {x: 13, y: 13, z: 13});
assert.deepStrictEqual(test_object.Inflate(cube), { x: 11, y: 11, z: 11 });
assert.deepStrictEqual(test_object.Inflate(cube), { x: 12, y: 12, z: 12 });
assert.deepStrictEqual(test_object.Inflate(cube), { x: 13, y: 13, z: 13 });
cube.t = 13;
assert.deepStrictEqual(
test_object.Inflate(cube), {x: 14, y: 14, z: 14, t: 14});
test_object.Inflate(cube), { x: 14, y: 14, z: 14, t: 14 });

const sym1 = Symbol('1');
const sym2 = Symbol('2');
Expand Down
Loading

0 comments on commit bb29405

Please sign in to comment.