Browse Source

lib: remove unnecessary assignments with _extend

The first parameter to `util._extend` is the target object. Assigning
the target object to the result of `util._extend` is not necessary.

PR-URL: https://github.com/nodejs/node/pull/11364

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
v6
Sakthipriyan Vairamani (thefourtheye) 8 years ago
parent
commit
dce37dc35b
No known key found for this signature in database GPG Key ID: C71F2437E9591758
  1. 4
      lib/_http_agent.js
  2. 4
      lib/_tls_wrap.js
  3. 2
      lib/child_process.js
  4. 6
      lib/internal/cluster/master.js

4
lib/_http_agent.js

@ -121,7 +121,7 @@ Agent.prototype.addRequest = function addRequest(req, options) {
} }
options = util._extend({}, options); options = util._extend({}, options);
options = util._extend(options, this.options); util._extend(options, this.options);
if (!options.servername) { if (!options.servername) {
options.servername = options.host; options.servername = options.host;
@ -176,7 +176,7 @@ Agent.prototype.addRequest = function addRequest(req, options) {
Agent.prototype.createSocket = function createSocket(req, options, cb) { Agent.prototype.createSocket = function createSocket(req, options, cb) {
var self = this; var self = this;
options = util._extend({}, options); options = util._extend({}, options);
options = util._extend(options, self.options); util._extend(options, self.options);
if (!options.servername) { if (!options.servername) {
options.servername = options.host; options.servername = options.host;

4
lib/_tls_wrap.js

@ -978,9 +978,9 @@ function normalizeConnectArgs(listArgs) {
// the host/port/path args that it knows about, not the tls options. // the host/port/path args that it knows about, not the tls options.
// This means that options.host overrides a host arg. // This means that options.host overrides a host arg.
if (listArgs[1] !== null && typeof listArgs[1] === 'object') { if (listArgs[1] !== null && typeof listArgs[1] === 'object') {
options = util._extend(options, listArgs[1]); util._extend(options, listArgs[1]);
} else if (listArgs[2] !== null && typeof listArgs[2] === 'object') { } else if (listArgs[2] !== null && typeof listArgs[2] === 'object') {
options = util._extend(options, listArgs[2]); util._extend(options, listArgs[2]);
} }
return (cb) ? [options, cb] : [options]; return (cb) ? [options, cb] : [options];

2
lib/child_process.js

@ -147,7 +147,7 @@ exports.execFile = function(file /*, args, options, callback*/) {
} }
if (pos < arguments.length && typeof arguments[pos] === 'object') { if (pos < arguments.length && typeof arguments[pos] === 'object') {
options = util._extend(options, arguments[pos++]); util._extend(options, arguments[pos++]);
} else if (pos < arguments.length && arguments[pos] == null) { } else if (pos < arguments.length && arguments[pos] == null) {
pos++; pos++;
} }

6
lib/internal/cluster/master.js

@ -48,8 +48,8 @@ cluster.setupMaster = function(options) {
execArgv: process.execArgv, execArgv: process.execArgv,
silent: false silent: false
}; };
settings = util._extend(settings, cluster.settings); util._extend(settings, cluster.settings);
settings = util._extend(settings, options || {}); util._extend(settings, options || {});
// Tell V8 to write profile data for each process to a separate file. // Tell V8 to write profile data for each process to a separate file.
// Without --logfile=v8-%p.log, everything ends up in a single, unusable // Without --logfile=v8-%p.log, everything ends up in a single, unusable
@ -110,7 +110,7 @@ function createWorkerProcess(id, env) {
var execArgv = cluster.settings.execArgv.slice(); var execArgv = cluster.settings.execArgv.slice();
var debugPort = 0; var debugPort = 0;
workerEnv = util._extend(workerEnv, env); util._extend(workerEnv, env);
workerEnv.NODE_UNIQUE_ID = '' + id; workerEnv.NODE_UNIQUE_ID = '' + id;
for (var i = 0; i < execArgv.length; i++) { for (var i = 0; i < execArgv.length; i++) {

Loading…
Cancel
Save