inquirerer 2.0.2 → 2.0.4

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 +14 -3
  2. package/package.json +2 -2
  3. package/prompt.js +14 -3
package/esm/prompt.js CHANGED
@@ -168,6 +168,7 @@ export class Inquirerer {
168
168
  }
169
169
  else {
170
170
  this.rl = null;
171
+ this.keypress = null;
171
172
  }
172
173
  }
173
174
  clearScreen() {
@@ -415,13 +416,23 @@ export class Inquirerer {
415
416
  if (typeof input === 'string') {
416
417
  const found = options.filter(opt => opt.name === input || String(opt.value) === input);
417
418
  if (found.length) {
418
- obj[question.name] = found;
419
+ obj[question.name] = found.map(f => {
420
+ return {
421
+ ...f,
422
+ selected: true
423
+ };
424
+ });
419
425
  }
420
426
  }
421
427
  else if (Array.isArray(input)) {
422
428
  const found = options.filter(opt => input.includes(opt.name) || input.includes(String(opt.value)));
423
429
  if (found.length) {
424
- obj[question.name] = found;
430
+ obj[question.name] = found.map(f => {
431
+ return {
432
+ ...f,
433
+ selected: true
434
+ };
435
+ });
425
436
  }
426
437
  }
427
438
  }
@@ -436,7 +447,7 @@ export class Inquirerer {
436
447
  }
437
448
  }
438
449
  async handleQuestionType(question, ctx) {
439
- this.keypress.clearHandlers();
450
+ this.keypress?.clearHandlers();
440
451
  switch (question.type) {
441
452
  case 'confirm':
442
453
  return this.confirm(question, ctx);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inquirerer",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
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": "f98034d733c0a9f3f1b1c9565698362534d2c720"
38
+ "gitHead": "fe5ce05ae6ffa6e93c6f91fc28b0d2be6de791fe"
39
39
  }
package/prompt.js CHANGED
@@ -174,6 +174,7 @@ class Inquirerer {
174
174
  }
175
175
  else {
176
176
  this.rl = null;
177
+ this.keypress = null;
177
178
  }
178
179
  }
179
180
  clearScreen() {
@@ -421,13 +422,23 @@ class Inquirerer {
421
422
  if (typeof input === 'string') {
422
423
  const found = options.filter(opt => opt.name === input || String(opt.value) === input);
423
424
  if (found.length) {
424
- obj[question.name] = found;
425
+ obj[question.name] = found.map(f => {
426
+ return {
427
+ ...f,
428
+ selected: true
429
+ };
430
+ });
425
431
  }
426
432
  }
427
433
  else if (Array.isArray(input)) {
428
434
  const found = options.filter(opt => input.includes(opt.name) || input.includes(String(opt.value)));
429
435
  if (found.length) {
430
- obj[question.name] = found;
436
+ obj[question.name] = found.map(f => {
437
+ return {
438
+ ...f,
439
+ selected: true
440
+ };
441
+ });
431
442
  }
432
443
  }
433
444
  }
@@ -442,7 +453,7 @@ class Inquirerer {
442
453
  }
443
454
  }
444
455
  async handleQuestionType(question, ctx) {
445
- this.keypress.clearHandlers();
456
+ this.keypress?.clearHandlers();
446
457
  switch (question.type) {
447
458
  case 'confirm':
448
459
  return this.confirm(question, ctx);