Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions benchmark/misc/util-extend-vs-object-assign.js

This file was deleted.

5 changes: 4 additions & 1 deletion doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -1540,6 +1540,9 @@ npx codemod@latest @nodejs/util-log-to-console-log

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/60812
description: End-of-Life.
- version: v22.0.0
pr-url: https://github.com/nodejs/node/pull/50488
description: Runtime deprecation.
Expand All @@ -1551,7 +1554,7 @@ changes:
description: Documentation-only deprecation.
-->

Type: Runtime
Type: End-of-Life

The [`util._extend()`][] API is deprecated because it's an unmaintained
legacy API that was exposed to user land by accident.
Expand Down
23 changes: 0 additions & 23 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,26 +236,6 @@ function inherits(ctor, superCtor) {
ObjectSetPrototypeOf(ctor.prototype, superCtor.prototype);
}

/**
* @deprecated since v6.0.0
* @template T
* @template S
* @param {T} target
* @param {S} source
* @returns {(T & S) | null}
*/
function _extend(target, source) {
// Don't do anything if source isn't an object
if (source === null || typeof source !== 'object') return target;

const keys = ObjectKeys(source);
let i = keys.length;
while (i--) {
target[keys[i]] = source[keys[i]];
}
return target;
}

const callbackifyOnRejected = (reason, cb) => {
// `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
// Because `null` is a special error value in callbacks which means "no error
Expand Down Expand Up @@ -468,9 +448,6 @@ function deprecate(fn, msg, code, { modifyPrototype } = {}) {
module.exports = {
_errnoException,
_exceptionWithHostPort,
_extend: internalDeprecate(_extend,
'The `util._extend` API is deprecated. Please use Object.assign() instead.',
'DEP0060'),
callbackify,
debug: debuglog,
debuglog,
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/tls-connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ exports.connect = function connect(options, callback) {
}).listen(0, function() {
server.server = this;

const optClient = util._extend({
const optClient = Object.assign({
port: this.address().port,
}, options.client);

Expand Down
9 changes: 0 additions & 9 deletions test/parallel/test-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,6 @@ assert.strictEqual(util.isArray(/regexp/), false);
assert.strictEqual(util.isArray(new Error()), false);
assert.strictEqual(util.isArray({ __proto__: Array.prototype }), false);

// _extend
assert.deepStrictEqual(util._extend({ a: 1 }), { a: 1 });
assert.deepStrictEqual(util._extend({ a: 1 }, []), { a: 1 });
assert.deepStrictEqual(util._extend({ a: 1 }, null), { a: 1 });
assert.deepStrictEqual(util._extend({ a: 1 }, true), { a: 1 });
assert.deepStrictEqual(util._extend({ a: 1 }, false), { a: 1 });
assert.deepStrictEqual(util._extend({ a: 1 }, { b: 2 }), { a: 1, b: 2 });
assert.deepStrictEqual(util._extend({ a: 1, b: 2 }, { b: 3 }), { a: 1, b: 3 });

assert.strictEqual(util.toUSVString('string\ud801'), 'string\ufffd');

{
Expand Down
Loading