mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
lib: remove internal util._extends() usage
This removes all internal calls to the deprecated `_extends()` function. It is slower than `Object.assign()` and the object spread notation since V8 6.8 and using the spread notation often also results in shorter code. PR-URL: https://github.com/nodejs/node/pull/25105 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
11
lib/https.js
11
lib/https.js
@@ -46,7 +46,7 @@ function Server(opts, requestListener) {
|
||||
requestListener = opts;
|
||||
opts = undefined;
|
||||
}
|
||||
opts = util._extend({}, opts);
|
||||
opts = { ...opts };
|
||||
|
||||
if (!opts.ALPNProtocols) {
|
||||
// http/1.0 is not defined as Protocol IDs in IANA
|
||||
@@ -110,9 +110,10 @@ function createConnection(port, host, options) {
|
||||
const session = this._getSession(options._agentKey);
|
||||
if (session) {
|
||||
debug('reuse session for %j', options._agentKey);
|
||||
options = util._extend({
|
||||
session: session
|
||||
}, options);
|
||||
options = {
|
||||
session,
|
||||
...options
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,7 +293,7 @@ function request(...args) {
|
||||
}
|
||||
|
||||
if (args[0] && typeof args[0] !== 'function') {
|
||||
options = util._extend(options, args.shift());
|
||||
Object.assign(options, args.shift());
|
||||
}
|
||||
|
||||
options._defaultAgent = globalAgent;
|
||||
|
||||
Reference in New Issue
Block a user