Skip to content

Commit 0424c81

Browse files
util: move deprecated util._extend() to EoL
1 parent 45eeb6f commit 0424c81

File tree

5 files changed

+5
-64
lines changed

5 files changed

+5
-64
lines changed

benchmark/misc/util-extend-vs-object-assign.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

doc/api/deprecations.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1540,6 +1540,9 @@ npx codemod@latest @nodejs/util-log-to-console-log
15401540

15411541
<!-- YAML
15421542
changes:
1543+
- version: REPLACEME
1544+
pr-url: https://github.com/nodejs/node/pull/60812
1545+
description: End-of-Life.
15431546
- version: v22.0.0
15441547
pr-url: https://github.com/nodejs/node/pull/50488
15451548
description: Runtime deprecation.
@@ -1551,7 +1554,7 @@ changes:
15511554
description: Documentation-only deprecation.
15521555
-->
15531556

1554-
Type: Runtime
1557+
Type: End-of-Life
15551558

15561559
The [`util._extend()`][] API is deprecated because it's an unmaintained
15571560
legacy API that was exposed to user land by accident.

lib/util.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -236,26 +236,6 @@ function inherits(ctor, superCtor) {
236236
ObjectSetPrototypeOf(ctor.prototype, superCtor.prototype);
237237
}
238238

239-
/**
240-
* @deprecated since v6.0.0
241-
* @template T
242-
* @template S
243-
* @param {T} target
244-
* @param {S} source
245-
* @returns {(T & S) | null}
246-
*/
247-
function _extend(target, source) {
248-
// Don't do anything if source isn't an object
249-
if (source === null || typeof source !== 'object') return target;
250-
251-
const keys = ObjectKeys(source);
252-
let i = keys.length;
253-
while (i--) {
254-
target[keys[i]] = source[keys[i]];
255-
}
256-
return target;
257-
}
258-
259239
const callbackifyOnRejected = (reason, cb) => {
260240
// `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
261241
// Because `null` is a special error value in callbacks which means "no error
@@ -468,9 +448,6 @@ function deprecate(fn, msg, code, { modifyPrototype } = {}) {
468448
module.exports = {
469449
_errnoException,
470450
_exceptionWithHostPort,
471-
_extend: internalDeprecate(_extend,
472-
'The `util._extend` API is deprecated. Please use Object.assign() instead.',
473-
'DEP0060'),
474451
callbackify,
475452
debug: debuglog,
476453
debuglog,

test/fixtures/tls-connect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ exports.connect = function connect(options, callback) {
5757
}).listen(0, function() {
5858
server.server = this;
5959

60-
const optClient = util._extend({
60+
const optClient = Object.assign({
6161
port: this.address().port,
6262
}, options.client);
6363

test/parallel/test-util.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,6 @@ assert.strictEqual(util.isArray(/regexp/), false);
4040
assert.strictEqual(util.isArray(new Error()), false);
4141
assert.strictEqual(util.isArray({ __proto__: Array.prototype }), false);
4242

43-
// _extend
44-
assert.deepStrictEqual(util._extend({ a: 1 }), { a: 1 });
45-
assert.deepStrictEqual(util._extend({ a: 1 }, []), { a: 1 });
46-
assert.deepStrictEqual(util._extend({ a: 1 }, null), { a: 1 });
47-
assert.deepStrictEqual(util._extend({ a: 1 }, true), { a: 1 });
48-
assert.deepStrictEqual(util._extend({ a: 1 }, false), { a: 1 });
49-
assert.deepStrictEqual(util._extend({ a: 1 }, { b: 2 }), { a: 1, b: 2 });
50-
assert.deepStrictEqual(util._extend({ a: 1, b: 2 }, { b: 3 }), { a: 1, b: 3 });
51-
5243
assert.strictEqual(util.toUSVString('string\ud801'), 'string\ufffd');
5344

5445
{

0 commit comments

Comments
 (0)