src/utils.js
function generateQuestions(config = {}, questions = {}) {
  const questionKeys = Object.keys(questions)

  if (!config) {
    return questionKeys.map(question => questions[question])
  }

  // If type is custom, filter question mandatory to work
  if (config.type === 'custom') {
    return generateQuestionsCustom(config, questions)
  }

  // filter questions from config object
  const filteredQuestions = []
  questionKeys.forEach((question) => {
    if (!(question in config)) {
      filteredQuestions.push(questions[question])
    }
  })

  return filteredQuestions
}
function generateQuestions(config = {}, questions = {}) {
  const questionKeys = Object.keys(questions)

  if (!config) {
    return questionKeys.map(question => questions[question])
  }

  // If type is custom, filter question mandatory to work
  if (config.type === 'custom') {
    return generateQuestionsCustom(config, questions)
  }

  // filter questions from config object
  const filteredQuestions = []
  questionKeys.forEach((question) => {
    if (!(question in config)) {
      filteredQuestions.push(questions[question])
    }
  })

  return filteredQuestions
}
function generateQuestions ( config = { } , questions = { } ) { const questionKeys = Object . keys ( questions ) if ( ! config ) { return questionKeys . map ( question => questions [ question ] ) } // If type is custom, filter question mandatory to work if ( config . type === 'custom' ) { return generateQuestionsCustom ( config , questions ) } // filter questions from config object const filteredQuestions = [ ] questionKeys . forEach ( ( question ) => { if ( ! ( question in config ) ) { filteredQuestions . push ( questions [ question ] ) } } ) return filteredQuestions }
Generate questions filtered by the config file if exist

@param {object} config
@param {object} questions
@returns {array}
Generate questions filtered by the config file if exist