0

Suppose I have an array that contains an object in yeoman prompt:

 const getDatabaseName = [
        {
            type: 'input',
            name: 'dbName',
            message: 'Please enter your database name:',
            default: 'testdb',
            store: true
        }
 ]

I know we could use props.dbName to retrieve user input for this object. But, how would I get the input using standard object call?

I tried this: getDatabaseName[0].dbName, but it's undefined.

Gaël Marziou
  • 16,028
  • 4
  • 38
  • 49
jukyduky
  • 39
  • 6
  • See yeoman doc, https://yeoman.io/authoring/user-interactions.html you indicated only how you declare prompt not how you run it with something like `this.answers = await this.prompt(getDabatabseName)`and then `answers.dbName` – Gaël Marziou Jul 29 '19 at 06:29
  • Is it possible to get the input without using async function? – jukyduky Jul 29 '19 at 16:42
  • As doc says: "The prompt method is asynchronous and returns a promise" – Gaël Marziou Jul 29 '19 at 16:52

0 Answers0