inquirerer 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/esm/prompt.js +4 -12
  2. package/package.json +2 -2
  3. package/prompt.js +4 -12
package/esm/prompt.js CHANGED
@@ -326,12 +326,8 @@ export class Inquirerer {
326
326
  });
327
327
  }
328
328
  async text(question, ctx) {
329
- if (this.noTty || !this.rl) {
330
- if ('default' in question) {
331
- return question.default;
332
- }
333
- return;
334
- }
329
+ if (this.noTty || !this.rl)
330
+ return question.default ?? null; // Return default if non-interactive
335
331
  let input = '';
336
332
  return new Promise((resolve) => {
337
333
  this.clearScreen();
@@ -448,12 +444,8 @@ export class Inquirerer {
448
444
  });
449
445
  }
450
446
  async autocomplete(question, ctx) {
451
- if (this.noTty || !this.rl) {
452
- if ('default' in question) {
453
- return question.default;
454
- }
455
- return;
456
- }
447
+ if (this.noTty || !this.rl)
448
+ return question.default ?? false; // Return default if non-interactive
457
449
  this.keypress.resume();
458
450
  const options = this.sanitizeOptions(question);
459
451
  let input = '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inquirerer",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "author": "Dan Lynch <pyramation@gmail.com>",
5
5
  "description": "inquirerer",
6
6
  "main": "index.js",
@@ -35,5 +35,5 @@
35
35
  "minimist": "^1.2.8"
36
36
  },
37
37
  "keywords": [],
38
- "gitHead": "df754ef4059b18c9a98378134f365fd0b8063d4c"
38
+ "gitHead": "fd80e2379caacef95200bef7b7f4778b8263355c"
39
39
  }
package/prompt.js CHANGED
@@ -332,12 +332,8 @@ class Inquirerer {
332
332
  });
333
333
  }
334
334
  async text(question, ctx) {
335
- if (this.noTty || !this.rl) {
336
- if ('default' in question) {
337
- return question.default;
338
- }
339
- return;
340
- }
335
+ if (this.noTty || !this.rl)
336
+ return question.default ?? null; // Return default if non-interactive
341
337
  let input = '';
342
338
  return new Promise((resolve) => {
343
339
  this.clearScreen();
@@ -454,12 +450,8 @@ class Inquirerer {
454
450
  });
455
451
  }
456
452
  async autocomplete(question, ctx) {
457
- if (this.noTty || !this.rl) {
458
- if ('default' in question) {
459
- return question.default;
460
- }
461
- return;
462
- }
453
+ if (this.noTty || !this.rl)
454
+ return question.default ?? false; // Return default if non-interactive
463
455
  this.keypress.resume();
464
456
  const options = this.sanitizeOptions(question);
465
457
  let input = '';