We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0ff93b6 commit b92a9a9Copy full SHA for b92a9a9
1 file changed
lib/prompt.js
@@ -192,6 +192,16 @@ prompt.history = function (search) {
192
// Gets input from the user via stdin for the specified message(s) `msg`.
193
//
194
prompt.get = function (schema, callback) {
195
+ if (typeof callback === 'function') return prompt._get(schema, callback);
196
+
197
+ return new Promise(function (resolve, reject) {
198
+ prompt._get(schema, function (err, result) {
199
+ return err ? reject(err) : resolve(result);
200
+ });
201
202
+};
203
204
+prompt._get = function (schema, callback) {
205
206
// Transforms a full JSON-schema into an array describing path and sub-schemas.
207
// Used for iteration purposes.
0 commit comments