From d4c91f28148af8a6c1a95392e5c88cb93d4b61c6 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Tue, 18 Dec 2018 03:15:57 +0100 Subject: lib: remove internal `util._extends()` usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca --- lib/tty.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lib/tty.js') diff --git a/lib/tty.js b/lib/tty.js index 62945a78eb..6efaac6e43 100644 --- a/lib/tty.js +++ b/lib/tty.js @@ -21,7 +21,7 @@ 'use strict'; -const { inherits, _extend } = require('util'); +const { inherits } = require('util'); const net = require('net'); const { TTY, isTTY } = internalBinding('tty_wrap'); const errors = require('internal/errors'); @@ -47,14 +47,13 @@ function ReadStream(fd, options) { throw new ERR_TTY_INIT_FAILED(ctx); } - options = _extend({ + net.Socket.call(this, { highWaterMark: 0, readable: true, writable: false, - handle: tty - }, options); - - net.Socket.call(this, options); + handle: tty, + ...options + }); this.isRaw = false; this.isTTY = true; -- cgit v1.2.3