{"size": 1098, "ext": "js", "max_stars_repo_path": "build/findPackageDependencies.js", "max_stars_repo_name": "2pulseTeam/import-js", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "build/findPackageDependencies.js", "max_issues_repo_name": "2pulseTeam/import-js", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "build/findPackageDependencies.js", "max_forks_repo_name": "2pulseTeam/import-js", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.1538461538, "max_line_length": 114, "alphanum_fraction": 0.7030965392}
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports['default'] = findPackageDependencies;

var _path = require('path');

var _path2 = _interopRequireDefault(_path);

var _FileUtils = require('./FileUtils');

var _FileUtils2 = _interopRequireDefault(_FileUtils);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

/**
 * Finds dependencies from package.json
 */
function findPackageDependencies(workingDirectory, includeDevDependencies) {
  var packageJson = _FileUtils2['default'].readJsonFile(_path2['default'].join(workingDirectory, 'package.json'));
  if (!packageJson) {
    return new Set([]);
  }

  var keys = ['dependencies', 'peerDependencies'];
  if (includeDevDependencies) {
    keys.push('devDependencies');
  }
  var result = new Set();
  keys.forEach(function (key) {
    if (Object.prototype.hasOwnProperty.call(packageJson, key)) {
      Object.keys(packageJson[key]).forEach(function (packageName) {
        result.add(packageName);
      });
    }
  });
  return result;
}
module.exports = exports['default'];