{"size": 716, "ext": "js", "max_stars_repo_path": "node_modules/grunt-jsdoc-to-markdown/tasks/jsdoc2md.js", "max_stars_repo_name": "mitchallen/maze-generator-square", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "node_modules/grunt-jsdoc-to-markdown/tasks/jsdoc2md.js", "max_issues_repo_name": "mitchallen/maze-generator-square", "max_issues_repo_issues_event_min_datetime": "2021-03-21T05:33:38.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-09T12:19:37.000Z", "max_forks_repo_path": "node_modules/grunt-jsdoc-to-markdown/tasks/jsdoc2md.js", "max_forks_repo_name": "mitchallen/maze-generator-core", "max_forks_repo_forks_event_min_datetime": "2018-11-03T17:54:19.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-03T17:54:19.000Z"}
{"max_stars_count": null, "max_issues_count": 2, "max_forks_count": 1, "avg_line_length": 27.5384615385, "max_line_length": 82, "alphanum_fraction": 0.6438547486}
'use strict'
var jsdoc2md = require('jsdoc-to-markdown')
var fs = require('fs')
var path = require('path')

module.exports = function (grunt) {
  grunt.registerMultiTask('jsdoc2md', 'API documentation generator', function () {
    var options = this.options()
    var done = this.async()

    var promises = this.files.map(function (file) {
      var outputPath = file.dest
      grunt.file.mkdir(path.dirname(outputPath))
      options.files = file.src
      grunt.log.oklns('writing ' + outputPath)
      return jsdoc2md.render(options)
        .then(function (output) {
          fs.writeFileSync(outputPath, output)
        })
        .catch(grunt.fail.fatal)
    })

    Promise.all(promises).then(done)
  })
}
