Skip to content
Merged
Changes from 1 commit
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
Next Next commit
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: #16959
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
cjihrig committed Nov 14, 2017
commit 8ae4e1cd7b5688b1a719d2104eef0fadfbdcacc9
10 changes: 5 additions & 5 deletions lib/tty.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ const errnoException = util._errnoException;
const errors = require('internal/errors');
const readline = require('readline');

exports.isatty = function(fd) {
function isatty(fd) {
return Number.isInteger(fd) && fd >= 0 && isTTY(fd);
};
}


function ReadStream(fd, options) {
Expand Down Expand Up @@ -60,8 +60,6 @@ function ReadStream(fd, options) {
}
inherits(ReadStream, net.Socket);

exports.ReadStream = ReadStream;

ReadStream.prototype.setRawMode = function(flag) {
flag = !!flag;
this._handle.setRawMode(flag);
Expand Down Expand Up @@ -102,7 +100,6 @@ function WriteStream(fd) {
}
}
inherits(WriteStream, net.Socket);
exports.WriteStream = WriteStream;


WriteStream.prototype.isTTY = true;
Expand Down Expand Up @@ -143,3 +140,6 @@ WriteStream.prototype.clearScreenDown = function() {
WriteStream.prototype.getWindowSize = function() {
return [this.columns, this.rows];
};


module.exports = { isatty, ReadStream, WriteStream };