From d17607351153b6f7639e41e8b286ceadfc4fe66d Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sat, 11 Nov 2017 22:58:26 -0500 Subject: [PATCH] tty: refactor exports This commit moves the tty module's exports to a single object, which is more aligned with other core modules. PR-URL: https://github.com/nodejs/node/pull/16959 Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- lib/tty.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/tty.js b/lib/tty.js index b9c829066d5f00..17b0acadc10441 100644 --- a/lib/tty.js +++ b/lib/tty.js @@ -8,10 +8,9 @@ const inherits = util.inherits; const errnoException = util._errnoException; const readline = require('readline'); - -exports.isatty = function(fd) { +function isatty(fd) { return Number.isInteger(fd) && fd >= 0 && isTTY(fd); -}; +} function ReadStream(fd, options) { @@ -32,8 +31,6 @@ function ReadStream(fd, options) { } inherits(ReadStream, net.Socket); -exports.ReadStream = ReadStream; - ReadStream.prototype.setRawMode = function(flag) { flag = !!flag; this._handle.setRawMode(flag); @@ -64,7 +61,6 @@ function WriteStream(fd) { } } inherits(WriteStream, net.Socket); -exports.WriteStream = WriteStream; WriteStream.prototype.isTTY = true; @@ -105,3 +101,6 @@ WriteStream.prototype.clearScreenDown = function() { WriteStream.prototype.getWindowSize = function() { return [this.columns, this.rows]; }; + + +module.exports = { isatty, ReadStream, WriteStream };