libs/ask.js
function prompt (data, key, prompt, done) {
  // skip prompts whose when condition is not met
  if (prompt.when && !evaluate(prompt.when, data)) {
    return done()
  }

  var promptDefault = prompt.default
  if (typeof prompt.default === 'function') {
    promptDefault = function () {
      return prompt.default.bind(this)(data)
    }
  }

  inquirer.prompt([{
    type: promptMapping[prompt.type] || prompt.type,
    name: key,
    message: prompt.message || prompt.label || key,
    default: promptDefault,
    choices: prompt.choices || [],
    validate: prompt.validate || function () { return true }
  }], function (answers) {
    if (Array.isArray(answers[key])) {
      data[key] = {}
      answers[key].forEach(function (multiChoiceAnswer) {
        data[key][multiChoiceAnswer] = true
      })
    } else if (typeof answers[key] === 'string') {
      data[key] = answers[key].replace(/"/g, '\\"')
    } else {
      data[key] = answers[key]
    }
    done()
  })
}
function prompt (data, key, prompt, done) {
  // skip prompts whose when condition is not met
  if (prompt.when && !evaluate(prompt.when, data)) {
    return done()
  }

  var promptDefault = prompt.default
  if (typeof prompt.default === 'function') {
    promptDefault = function () {
      return prompt.default.bind(this)(data)
    }
  }

  inquirer.prompt([{
    type: promptMapping[prompt.type] || prompt.type,
    name: key,
    message: prompt.message || prompt.label || key,
    default: promptDefault,
    choices: prompt.choices || [],
    validate: prompt.validate || function () { return true }
  }], function (answers) {
    if (Array.isArray(answers[key])) {
      data[key] = {}
      answers[key].forEach(function (multiChoiceAnswer) {
        data[key][multiChoiceAnswer] = true
      })
    } else if (typeof answers[key] === 'string') {
      data[key] = answers[key].replace(/"/g, '\\"')
    } else {
      data[key] = answers[key]
    }
    done()
  })
}
function prompt ( data , key , prompt , done ) { // skip prompts whose when condition is not met if ( prompt . when && ! evaluate ( prompt . when , data ) ) { return done ( ) } var promptDefault = prompt . default if ( typeof prompt . default === 'function' ) { promptDefault = function ( ) { return prompt . default . bind ( this ) ( data ) } } inquirer . prompt ( [ { type : promptMapping [ prompt . type ] || prompt . type , name : key , message : prompt . message || prompt . label || key , default : promptDefault , choices : prompt . choices || [ ] , validate : prompt . validate || function ( ) { return true } } ] , function ( answers ) { if ( Array . isArray ( answers [ key ] ) ) { data [ key ] = { } answers [ key ] . forEach ( function ( multiChoiceAnswer ) { data [ key ] [ multiChoiceAnswer ] = true } ) } else if ( typeof answers [ key ] === 'string' ) { data [ key ] = answers [ key ] . replace ( / " / g , '\\"' ) } else { data [ key ] = answers [ key ] } done ( ) } ) }
Inquirer prompt wrapper.

@param {Object} data
@param {String} key
@param {Object} prompt
@param {Function} done
Inquirer prompt wrapper .