<commit_before>var fs = require('fs')
var path = require('path')

var semver = require('semver')
var merge = require('merge')

var errors = require('./errors')
var InvalidDependencyError = errors.InvalidDependencyError
var MissingDependenciesError = errors.MissingDependenciesError
var UnsavedDependenciesError = errors.UnsavedDependenciesError

function isScopedDirectory (directory) {
  return directory[0] === '@'
}

function getScopedModuleDirectories (baseDirectory, scope) {
  return getModuleDirectories(path.join(baseDirectory, scope))
    .map(function (directory) {
      return path.join(scope, directory)
    })
}

function getModuleDirectories (baseDirectory) {
  var dirs = []
  fs.readdirSync(baseDirectory).forEach(function (directory) {
    if (isScopedDirectory(directory)) {
      dirs = dirs.concat(getScopedModuleDirectories(baseDirectory, directory))
    } else if (directory[0] !== '.') {
      dirs.push(directory)
    }
  })
  return dirs
}

function getModuleVersion (basePath, module) {
  return JSON.parse(
      fs.readFileSync(path.join(basePath, module, 'package.json'))
  ).version
}

function getInstalledDependencies (nodeModulesPath) {<commit_msg>Fix indentation<commit_after>var fs = require('fs')
var path = require('path')

var semver = require('semver')
var merge = require('merge')

var errors = require('./errors')
var InvalidDependencyError = errors.InvalidDependencyError
var MissingDependenciesError = errors.MissingDependenciesError
var UnsavedDependenciesError = errors.UnsavedDependenciesError

function isScopedDirectory (directory) {
  return directory[0] === '@'
}

function getScopedModuleDirectories (baseDirectory, scope) {
  return getModuleDirectories(path.join(baseDirectory, scope))
    .map(function (directory) {
      return path.join(scope, directory)
    })
}

function getModuleDirectories (baseDirectory) {
  var dirs = []
  fs.readdirSync(baseDirectory).forEach(function (directory) {
    if (isScopedDirectory(directory)) {
      dirs = dirs.concat(getScopedModuleDirectories(baseDirectory, directory))
    } else if (directory[0] !== '.') {
      dirs.push(directory)
    }
  })
  return dirs
}

function getModuleVersion (basePath, module) {
  return JSON.parse(
    fs.readFileSync(path.join(basePath, module, 'package.json'))
  ).version
}

function getInstalledDependencies (nodeModulesPath) {
{'fraction_non_alphanumeric': 0.116751269035533, 'fraction_numerical': 0.001692047377326565, 'mean_word_length': 5.289893617021277, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '193729', 'n_tokens_mistral': 687, 'n_tokens_neox': 678, 'n_words': 145}