diff --git a/benchmark/es/spread-assign.js b/benchmark/es/spread-assign.js index f0dcd56bb606b1..211979c710baf3 100644 --- a/benchmark/es/spread-assign.js +++ b/benchmark/es/spread-assign.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common.js'); -const util = require('util'); const bench = common.createBenchmark(main, { - method: ['spread', 'assign', '_extend'], + method: ['spread', 'assign'], count: [5, 10, 20], n: [1e6], }); @@ -18,12 +17,6 @@ function main({ n, context, count, rest, method }) { let obj; switch (method) { - case '_extend': - bench.start(); - for (let i = 0; i < n; i++) - obj = util._extend({}, src); - bench.end(n); - break; case 'assign': bench.start(); for (let i = 0; i < n; i++) diff --git a/benchmark/misc/util-extend-vs-object-assign.js b/benchmark/misc/util-extend-vs-object-assign.js deleted file mode 100644 index e2ac0a5417e489..00000000000000 --- a/benchmark/misc/util-extend-vs-object-assign.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; - -const common = require('../common.js'); -const util = require('util'); - -const bench = common.createBenchmark(main, { - type: ['extend', 'assign'], - n: [10e4], -}); - -function main({ n, type }) { - let fn; - if (type === 'extend') { - fn = util._extend; - } else if (type === 'assign') { - fn = Object.assign; - } - - // Force-optimize the method to test so that the benchmark doesn't - // get disrupted by the optimizer kicking in halfway through. - for (let i = 0; i < type.length * 10; i += 1) - fn({}, process.env); - - const obj = new Proxy({}, { set: function(a, b, c) { return true; } }); - - bench.start(); - for (let j = 0; j < n; j += 1) - fn(obj, process.env); - bench.end(n); -} diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 0928803fc6281c..b921b30c6c04c3 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1363,6 +1363,9 @@ requirements and complexity of your application. -Type: Runtime +Type: End-of-Life -The [`util._extend()`][] API is deprecated because it's an unmaintained +The `util._extend()` API has been removed because it's an unmaintained legacy API that was exposed to user land by accident. Please use `target = Object.assign(target, source)` instead. @@ -3769,7 +3772,6 @@ is deprecated to better align with recommendations per [NIST SP 800-38D][]. [`url.format()`]: url.md#urlformaturlobject [`url.parse()`]: url.md#urlparseurlstring-parsequerystring-slashesdenotehost [`url.resolve()`]: url.md#urlresolvefrom-to -[`util._extend()`]: util.md#util_extendtarget-source [`util.getSystemErrorName()`]: util.md#utilgetsystemerrornameerr [`util.inspect()`]: util.md#utilinspectobject-options [`util.inspect.custom`]: util.md#utilinspectcustom diff --git a/doc/api/util.md b/doc/api/util.md index 477e91f2680770..4408fb4a2737d8 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -2923,24 +2923,6 @@ util.types.isWeakSet(new WeakSet()); // Returns true The following APIs are deprecated and should no longer be used. Existing applications and modules should be updated to find alternative approaches. -### `util._extend(target, source)` - - - -> Stability: 0 - Deprecated: Use [`Object.assign()`][] instead. - -* `target` {Object} -* `source` {Object} - -The `util._extend()` method was never intended to be used outside of internal -Node.js modules. The community found and used it anyway. - -It is deprecated and should not be used in new code. JavaScript comes with very -similar built-in functionality through [`Object.assign()`][]. - ### `util.isArray(object)`