inquirerer 1.6.0 → 1.6.1

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.
package/esm/prompt.js CHANGED
@@ -252,9 +252,10 @@ export class Inquirerer {
252
252
  this.close();
253
253
  }
254
254
  async prompt(argv, questions, options) {
255
- let obj = (this.mutateArgs || options.mutateArgs) ? argv : { ...argv };
255
+ // use local mutateArgs if defined, otherwise global mutateArgs
256
+ const shouldMutate = options?.mutateArgs !== undefined ? options.mutateArgs : this.mutateArgs;
257
+ let obj = shouldMutate ? argv : { ...argv };
256
258
  // Assuming questions is an array of Question objects and argv is the parsed command line arguments object.
257
- // @ts-ignore
258
259
  if (this.noTty && questions.some(question => question.required && this.isEmptyAnswer(argv[question.name]))) {
259
260
  for (let index = 0; index < questions.length; index++) {
260
261
  const question = questions[index];
@@ -263,7 +264,6 @@ export class Inquirerer {
263
264
  obj[question.name] = question.default;
264
265
  }
265
266
  }
266
- // @ts-ignore
267
267
  if (!questions.some(question => question.required && this.isEmptyAnswer(argv[question.name]))) {
268
268
  return obj;
269
269
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inquirerer",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
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": "7c0bfaacaac54980e2a1a1c918fd069e9260437f"
38
+ "gitHead": "25c70c84b496b546e74bd4268eadc0a49bc6d9e7"
39
39
  }
package/prompt.js CHANGED
@@ -258,9 +258,10 @@ class Inquirerer {
258
258
  this.close();
259
259
  }
260
260
  async prompt(argv, questions, options) {
261
- let obj = (this.mutateArgs || options.mutateArgs) ? argv : { ...argv };
261
+ // use local mutateArgs if defined, otherwise global mutateArgs
262
+ const shouldMutate = options?.mutateArgs !== undefined ? options.mutateArgs : this.mutateArgs;
263
+ let obj = shouldMutate ? argv : { ...argv };
262
264
  // Assuming questions is an array of Question objects and argv is the parsed command line arguments object.
263
- // @ts-ignore
264
265
  if (this.noTty && questions.some(question => question.required && this.isEmptyAnswer(argv[question.name]))) {
265
266
  for (let index = 0; index < questions.length; index++) {
266
267
  const question = questions[index];
@@ -269,7 +270,6 @@ class Inquirerer {
269
270
  obj[question.name] = question.default;
270
271
  }
271
272
  }
272
- // @ts-ignore
273
273
  if (!questions.some(question => question.required && this.isEmptyAnswer(argv[question.name]))) {
274
274
  return obj;
275
275
  }