How to use the _extend function from util

Find comprehensive JavaScript util._extend code examples handpicked from public code repositorys.

143
144
145
146
147
148
149
150
151
    port,
    localAddress
  };
}

options = util._extend({}, options);
util._extend(options, this.options);
if (options.socketPath)
  options.path = options.socketPath;
fork icon19
star icon213
watch icon17

+ 9 other calls in file

37
38
39
40
41
42
43
44
45
46
if (!(this instanceof ReadStream))
  return new ReadStream(fd, options);
if (fd >> 0 !== fd || fd < 0)
  throw new errors.RangeError('ERR_INVALID_FD', fd);

options = util._extend({
  highWaterMark: 0,
  readable: true,
  writable: false,
  handle: new TTY(fd, true)
fork icon19
star icon213
watch icon17

201
202
203
204
205
206
207
208
209
210
if (self._disposed)
  return;

if (fnargs[0] && fnargs[0] instanceof Error) {
  var er = fnargs[0];
  util._extend(er, {
    domainBound: cb,
    domainThrown: false,
    domain: self
  });
fork icon0
star icon9
watch icon2

1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
    this.requests[name].push(req);
  }
};
Agent.prototype.createSocket = function(name, host, port, localAddress) {
  var self = this;
  var options = util._extend({}, self.options);
  options.port = port;
  options.host = host;
  options.localAddress = localAddress;
  var s = self.createConnection(options);
fork icon3
star icon3
watch icon0

43
44
45
46
47
48
49
50
51
52

if (typeof opts === 'function') {
  requestListener = opts;
  opts = undefined;
}
opts = util._extend({}, opts);

if (process.features.tls_alpn && !opts.ALPNProtocols) {
  // http/1.0 is not defined as Protocol IDs in IANA
  // http://www.iana.org/assignments/tls-extensiontype-values
fork icon0
star icon1
watch icon2

+ 3 other calls in file

78
79
80
81
82
83
84
85
86
87
88
89
90


// old api surface
glob.glob = glob


glob.hasMagic = function (pattern, options_) {
  var options = util._extend({}, options_)
  options.noprocess = true


  var g = new Glob(pattern, options)
  var set = g.minimatch.set
fork icon0
star icon0
watch icon1

66
67
68
69
70
71
72
73
74
75
76
77
 * @return {Object}
 * @api private
 */


exports.merge = (a, b) => {
  return util._extend(a, b); // eslint-disable-line no-underscore-dangle
};


/**
 * Return a unique identifier with the given `len`.
fork icon0
star icon0
watch icon0

63
64
65
66
67
68
69
70
71

Console.prototype.error = Console.prototype.warn;


Console.prototype.dir = function(object, options) {
  this._stdout.write(util.inspect(object, util._extend({
    customInspect: false
  }, options)) + '\n');
};
fork icon0
star icon0
watch icon6

33
34
35
36
37
38
39
40
41
42

if (pos < arguments.length && arguments[pos] != null) {
  if (typeof arguments[pos] !== 'object') {
    throw new TypeError('Incorrect value of args option');
  } else {
    options = util._extend({}, arguments[pos++]);
  }
}

// Prepare arguments for fork:
fork icon0
star icon0
watch icon2

+ 3 other calls in file

48
49
50
51
52
53
54
55
56
57
const tty = new TTY(fd, true, ctx);
if (ctx.code !== undefined) {
  throw new errors.SystemError(ctx);
}

options = _extend({
  highWaterMark: 0,
  readable: true,
  writable: false,
  handle: tty
fork icon0
star icon0
watch icon2

66
67
68
69
70
71
72
73
74
75
    typeof options === 'function') {
  return defaultOptions;
}

if (typeof options === 'string') {
  defaultOptions = util._extend({}, defaultOptions);
  defaultOptions.encoding = options;
  options = defaultOptions;
} else if (typeof options !== 'object') {
  throw new errors.TypeError('ERR_INVALID_ARG_TYPE',
fork icon0
star icon0
watch icon8

383
384
385
386
387
388
389
390
391
392

    Stability: 0 - Deprecated: Use [`console.log()`][] instead.

Deprecated predecessor of `console.log`.

## util._extend(obj)

    Stability: 0 - Deprecated: Use Object.assign() instead.

`_extend` was never intended to be used outside of internal NodeJS modules. The
fork icon0
star icon0
watch icon2