{"size": 512, "ext": "js", "max_stars_repo_path": "bin/blog/prompts/post.js", "max_stars_repo_name": "phazonoverload/deved-platform", "max_stars_repo_stars_event_min_datetime": "2020-10-05T14:19:06.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-30T22:29:35.000Z", "max_issues_repo_path": "bin/blog/prompts/post.js", "max_issues_repo_name": "phazonoverload/deved-platform", "max_issues_repo_issues_event_min_datetime": "2020-06-26T16:55:08.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-29T15:36:06.000Z", "max_forks_repo_path": "bin/blog/prompts/post.js", "max_forks_repo_name": "phazonoverload/deved-platform", "max_forks_repo_forks_event_min_datetime": "2020-10-09T12:53:54.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-10T19:35:22.000Z"}
{"max_stars_count": 14, "max_issues_count": 1783, "max_forks_count": 20, "avg_line_length": 21.3333333333, "max_line_length": 62, "alphanum_fraction": 0.419921875}
module.exports = (posts) => ({
  type: 'autocomplete',
  name: 'post',
  message: 'What post would you like to translate?',
  source: (answers, input) => {
    let opts = posts.find({})

    if (input !== undefined && input !== '') {
      opts = posts.find({
        $or: [
          {
            title: { $regex: [input, 'i'] },
          },
          {
            file: { $regex: [input, 'i'] },
          },
        ],
      })
    }

    return opts.map((o) => ({ name: o.title, value: o.file }))
  },
})
