Fix: setPrompt()
changes prompt
to '' if no argument.
This commit is contained in:
parent
06254667d6
commit
03cdd60eb6
2 changed files with 5 additions and 3 deletions
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue