| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent bbace72 commit ac97a53
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,10 +1,9 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | 3 | const common = require('../common.js'); | |
| 4 | - const util = require('util'); | ||
| 5 | 4 | ||
| 6 | 5 | const bench = common.createBenchmark(main, { | |
| 7 | - method: ['spread', 'assign', '_extend'], | ||
| 6 | + method: ['spread', 'assign'], | ||
| 8 | 7 | count: [5, 10, 20], | |
| 9 | 8 | n: [1e6], | |
| 10 | 9 | }); | |
@@ -18,12 +17,6 @@ function main({ n, context, count, rest, method }) { | |||
| 18 | 17 | let obj; | |
| 19 | 18 | ||
| 20 | 19 | switch (method) { | |
| 21 | - case '_extend': | ||
| 22 | - bench.start(); | ||
| 23 | - for (let i = 0; i < n; i++) | ||
| 24 | - obj = util._extend({}, src); | ||
| 25 | - bench.end(n); | ||
| 26 | - break; | ||
| 27 | 20 | case 'assign': | |
| 28 | 21 | bench.start(); | |
| 29 | 22 | for (let i = 0; i < n; i++) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1363,6 +1363,9 @@ requirements and complexity of your application. | |||
| 1363 | 1363 | ||
| 1364 | 1364 | <!-- YAML | |
| 1365 | 1365 | changes: | |
| 1366 | + - version: REPLACEME | ||
| 1367 | + pr-url: https://github.com/nodejs/node/pull/52744 | ||
| 1368 | + description: End-of-Life deprecation. | ||
| 1366 | 1369 | - version: v22.0.0 | |
| 1367 | 1370 | pr-url: https://github.com/nodejs/node/pull/50488 | |
| 1368 | 1371 | description: Runtime deprecation. | |
@@ -1374,9 +1377,9 @@ changes: | |||
| 1374 | 1377 | description: Documentation-only deprecation. | |
| 1375 | 1378 | --> | |
| 1376 | 1379 | ||
| 1377 | - Type: Runtime | ||
| 1380 | + Type: End-of-Life | ||
| 1378 | 1381 | ||
| 1379 | - The [`util._extend()`][] API is deprecated because it's an unmaintained | ||
| 1382 | + The `util._extend()` API has been removed because it's an unmaintained | ||
| 1380 | 1383 | legacy API that was exposed to user land by accident. | |
| 1381 | 1384 | Please use `target = Object.assign(target, source)` instead. | |
| 1382 | 1385 | ||
@@ -3769,7 +3772,6 @@ is deprecated to better align with recommendations per [NIST SP 800-38D][]. | |||
| 3769 | 3772 | [`url.format()`]: url.md#urlformaturlobject | |
| 3770 | 3773 | [`url.parse()`]: url.md#urlparseurlstring-parsequerystring-slashesdenotehost | |
| 3771 | 3774 | [`url.resolve()`]: url.md#urlresolvefrom-to | |
| 3772 | - [`util._extend()`]: util.md#util_extendtarget-source | ||
| 3773 | 3775 | [`util.getSystemErrorName()`]: util.md#utilgetsystemerrornameerr | |
| 3774 | 3776 | [`util.inspect()`]: util.md#utilinspectobject-options | |
| 3775 | 3777 | [`util.inspect.custom`]: util.md#utilinspectcustom | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2923,24 +2923,6 @@ util.types.isWeakSet(new WeakSet()); // Returns true | |||
| 2923 | 2923 | The following APIs are deprecated and should no longer be used. Existing | |
| 2924 | 2924 | applications and modules should be updated to find alternative approaches. | |
| 2925 | 2925 | ||
| 2926 | - ### `util._extend(target, source)` | ||
| 2927 | - | ||
| 2928 | - <!-- YAML | ||
| 2929 | - added: v0.7.5 | ||
| 2930 | - deprecated: v6.0.0 | ||
| 2931 | - --> | ||
| 2932 | - | ||
| 2933 | - > Stability: 0 - Deprecated: Use [`Object.assign()`][] instead. | ||
| 2934 | - | ||
| 2935 | - * `target` {Object} | ||
| 2936 | - * `source` {Object} | ||
| 2937 | - | ||
| 2938 | - The `util._extend()` method was never intended to be used outside of internal | ||
| 2939 | - Node.js modules. The community found and used it anyway. | ||
| 2940 | - | ||
| 2941 | - It is deprecated and should not be used in new code. JavaScript comes with very | ||
| 2942 | - similar built-in functionality through [`Object.assign()`][]. | ||
| 2943 | - | ||
| 2944 | 2926 | ### `util.isArray(object)` | |
| 2945 | 2927 | ||
| 2946 | 2928 | <!-- YAML | |
@@ -3410,7 +3392,6 @@ util.log('Timestamped message.'); | |||
| 3410 | 3392 | [`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify | |
| 3411 | 3393 | [`MIMEparams`]: #class-utilmimeparams | |
| 3412 | 3394 | [`Map`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map | |
| 3413 | - [`Object.assign()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign | ||
| 3414 | 3395 | [`Object.freeze()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze | |
| 3415 | 3396 | [`Promise`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise | |
| 3416 | 3397 | [`Proxy`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -299,26 +299,6 @@ function inherits(ctor, superCtor) { | |||
| 299 | 299 | ObjectSetPrototypeOf(ctor.prototype, superCtor.prototype); | |
| 300 | 300 | } | |
| 301 | 301 | ||
| 302 | - /** | ||
| 303 | - * @deprecated since v6.0.0 | ||
| 304 | - * @template T | ||
| 305 | - * @template S | ||
| 306 | - * @param {T} target | ||
| 307 | - * @param {S} source | ||
| 308 | - * @returns {S extends null ? T : (T & S)} | ||
| 309 | - */ | ||
| 310 | - function _extend(target, source) { | ||
| 311 | - // Don't do anything if source isn't an object | ||
| 312 | - if (source === null || typeof source !== 'object') return target; | ||
| 313 | - | ||
| 314 | - const keys = ObjectKeys(source); | ||
| 315 | - let i = keys.length; | ||
| 316 | - while (i--) { | ||
| 317 | - target[keys[i]] = source[keys[i]]; | ||
| 318 | - } | ||
| 319 | - return target; | ||
| 320 | - } | ||
| 321 | - | ||
| 322 | 302 | const callbackifyOnRejected = (reason, cb) => { | |
| 323 | 303 | // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M). | |
| 324 | 304 | // Because `null` is a special error value in callbacks which means "no error | |
@@ -425,9 +405,6 @@ function parseEnv(content) { | |||
| 425 | 405 | module.exports = { | |
| 426 | 406 | _errnoException, | |
| 427 | 407 | _exceptionWithHostPort, | |
| 428 | - _extend: deprecate(_extend, | ||
| 429 | - 'The `util._extend` API is deprecated. Please use Object.assign() instead.', | ||
| 430 | - 'DEP0060'), | ||
| 431 | 408 | callbackify, | |
| 432 | 409 | debug: debuglog, | |
| 433 | 410 | debuglog, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,7 +57,7 @@ exports.connect = function connect(options, callback) { | |||
| 57 | 57 | }).listen(0, function() { | |
| 58 | 58 | server.server = this; | |
| 59 | 59 | ||
| 60 | - const optClient = util._extend({ | ||
| 60 | + const optClient = Object.assign({ | ||
| 61 | 61 | port: this.address().port, | |
| 62 | 62 | }, options.client); | |
| 63 | 63 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -102,15 +102,6 @@ assert.strictEqual(util.isPrimitive(Symbol('symbol')), true); | |||
| 102 | 102 | assert.strictEqual(util.isBuffer('foo'), false); | |
| 103 | 103 | assert.strictEqual(util.isBuffer(Buffer.from('foo')), true); | |
| 104 | 104 | ||
| 105 | - // _extend | ||
| 106 | - assert.deepStrictEqual(util._extend({ a: 1 }), { a: 1 }); | ||
| 107 | - assert.deepStrictEqual(util._extend({ a: 1 }, []), { a: 1 }); | ||
| 108 | - assert.deepStrictEqual(util._extend({ a: 1 }, null), { a: 1 }); | ||
| 109 | - assert.deepStrictEqual(util._extend({ a: 1 }, true), { a: 1 }); | ||
| 110 | - assert.deepStrictEqual(util._extend({ a: 1 }, false), { a: 1 }); | ||
| 111 | - assert.deepStrictEqual(util._extend({ a: 1 }, { b: 2 }), { a: 1, b: 2 }); | ||
| 112 | - assert.deepStrictEqual(util._extend({ a: 1, b: 2 }, { b: 3 }), { a: 1, b: 3 }); | ||
| 113 | - | ||
| 114 | 105 | // deprecated | |
| 115 | 106 | assert.strictEqual(util.isBoolean(true), true); | |
| 116 | 107 | assert.strictEqual(util.isBoolean(false), true); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments