summaryrefslogtreecommitdiff
path: root/lib/readline.js
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2013-07-26 14:38:08 -0700
committerisaacs <i@izs.me>2013-08-01 15:08:01 -0700
commit22c68fdc1dae40f0ed9c71a02f66e5b2c6353691 (patch)
treeb6d14cad6f5a9ba78172f77c5c2ec10b8a6cb89c /lib/readline.js
parent9a29aa8c552eb2b120c101c1cfd66ba565a17ed5 (diff)
downloadnodejs-22c68fdc1dae40f0ed9c71a02f66e5b2c6353691.tar.gz
nodejs-22c68fdc1dae40f0ed9c71a02f66e5b2c6353691.tar.bz2
nodejs-22c68fdc1dae40f0ed9c71a02f66e5b2c6353691.zip
src: Replace macros with util functions
Diffstat (limited to 'lib/readline.js')
-rw-r--r--lib/readline.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/readline.js b/lib/readline.js
index f2035306d..60e725c8b 100644
--- a/lib/readline.js
+++ b/lib/readline.js
@@ -63,13 +63,13 @@ function Interface(input, output, completer, terminal) {
completer = completer || function() { return []; };
- if (!IS_FUNCTION(completer)) {
+ if (!util.isFunction(completer)) {
throw new TypeError('Argument \'completer\' must be a function');
}
// backwards compat; check the isTTY prop of the output stream
// when `terminal` was not specified
- if (IS_UNDEFINED(terminal)) {
+ if (util.isUndefined(terminal)) {
terminal = !!output.isTTY;
}
@@ -154,7 +154,7 @@ Interface.prototype.setPrompt = function(prompt) {
Interface.prototype._setRawMode = function(mode) {
- if (IS_FUNCTION(this.input.setRawMode)) {
+ if (util.isFunction(this.input.setRawMode)) {
return this.input.setRawMode(mode);
}
};
@@ -172,7 +172,7 @@ Interface.prototype.prompt = function(preserveCursor) {
Interface.prototype.question = function(query, cb) {
- if (IS_FUNCTION(cb)) {
+ if (util.isFunction(cb)) {
if (this._questionCallback) {
this.prompt();
} else {
@@ -290,7 +290,7 @@ Interface.prototype.write = function(d, key) {
// \r\n, \n, or \r followed by something other than \n
var lineEnding = /\r?\n|\r(?!\n)/;
Interface.prototype._normalWrite = function(b) {
- if (IS_UNDEFINED(b)) {
+ if (util.isUndefined(b)) {
return;
}
var string = this._decoder.write(b);
@@ -843,7 +843,7 @@ Interface.prototype._ttyWrite = function(s, key) {
break;
default:
- if (IS_BUFFER(s))
+ if (util.isBuffer(s))
s = s.toString('utf-8');
if (s) {
@@ -944,8 +944,8 @@ function emitKey(stream, s) {
},
parts;
- if (IS_BUFFER(s)) {
- if (s[0] > 127 && IS_UNDEFINED(s[1])) {
+ if (util.isBuffer(s)) {
+ if (s[0] > 127 && util.isUndefined(s[1])) {
s[0] -= 128;
s = '\x1b' + s.toString(stream.encoding || 'utf-8');
} else {
@@ -1124,7 +1124,7 @@ function emitKey(stream, s) {
}
// Don't emit a key if no name was found
- if (IS_UNDEFINED(key.name)) {
+ if (util.isUndefined(key.name)) {
key = undefined;
}
@@ -1143,13 +1143,13 @@ function emitKey(stream, s) {
*/
function cursorTo(stream, x, y) {
- if (!IS_NUMBER(x) && !IS_NUMBER(y))
+ if (!util.isNumber(x) && !util.isNumber(y))
return;
- if (!IS_NUMBER(x))
+ if (!util.isNumber(x))
throw new Error("Can't set cursor row without also setting it's column");
- if (!IS_NUMBER(y)) {
+ if (!util.isNumber(y)) {
stream.write('\x1b[' + (x + 1) + 'G');
} else {
stream.write('\x1b[' + (y + 1) + ';' + (x + 1) + 'H');