You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library is great, except it seems to have left out a key part of the readline API out: the question method.
Currently if I log the method in readline-promise I see:
function (query, cb) {
if (typeof cb === 'function') {
if (this._questionCallback) {
this.prompt();
} else {
this._oldPrompt = this._prompt;
this.setPrompt(query);
this._questionCallback = cb;
this.prompt();
}
}
}
In other words, I see the normal (readline not readline-promise) style question function which takes a callback. It would seem more appropriate for the readline-promise version to be something like:
function (query) {
if (this._questionCallback) {
return this.prompt();
} else {
this._oldPrompt = this._prompt;
this.setPrompt(query);
return this.prompt();
}
}
(The above assumes prompt returns a promise; if not some further adjustment might be necessary.)
Is something like this possible/desired?
The text was updated successfully, but these errors were encountered:
machineghost
changed the title
add support for question?
Add support for the "question" method
Feb 8, 2018
In general, methods with callbacks are easy to promisify whereas streams take a bit more work. I can add a questionAsync method that would just be something like
This library is great, except it seems to have left out a key part of the
readline
API out: thequestion
method.Currently if I log the method in
readline-promise
I see:In other words, I see the normal (
readline
notreadline-promise
) stylequestion
function which takes a callback. It would seem more appropriate for thereadline-promise
version to be something like:(The above assumes
prompt
returns a promise; if not some further adjustment might be necessary.)Is something like this possible/desired?
The text was updated successfully, but these errors were encountered: