From 03cdd60eb67062912080ba5dc159e562c9ce8b12 Mon Sep 17 00:00:00 2001 From: anseki Date: Sun, 13 Jul 2014 21:30:04 +0900 Subject: [PATCH] Fix: `setPrompt()` changes `prompt` to '' if no argument. --- lib/readline-sync.js | 6 ++++-- package.json | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/readline-sync.js b/lib/readline-sync.js index 99bdb15..524308d 100644 --- a/lib/readline-sync.js +++ b/lib/readline-sync.js @@ -24,7 +24,7 @@ var function _readlineSync(display, options) { var input = '', rsize, err; - if (display !== '') { + if (display !== '') { // null and undefined were excluded. if (typeof print === 'function') { print(display, encoding); } stdout.write(display + '', encoding); } @@ -154,8 +154,10 @@ exports.setPrint = function(fnc) { print = fnc; }; exports.setPrompt = function(newPrompt) { /* jshint eqnull:true */ - promptText = newPrompt != null ? newPrompt : ''; + if (newPrompt != null) { /* jshint eqnull:false */ + promptText = newPrompt; + } return promptText; }; diff --git a/package.json b/package.json index 2f0d7e7..356ccde 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "readline-sync", "description": "Synchronous Readline", - "version": "0.4.4", + "version": "0.4.5", "homepage": "https://github.com/anseki/readline-sync", "author": { "name": "anseki"