/**
 * Print locales settings.
 * @function print
 * @param {object} locales - locales settings to print.
 */

'use strict'

const colorprint = require('colorprint'),
  colors = colorprint.colors,
  yaml = require('js-yaml')

function _types (modules) {
  let values = {}
  Object.keys(modules).forEach((key) => {
    values[ key ] = typeof modules[ key ];
  })
  return values;
}

/** @lends print */
function print (modules, namespace) {
  let values = _types(modules)
  colorprint.debug('')
  let title = 'Modules'
  if (namespace) {
    title = [ title, namespace ].join(' in ')
  }
  colorprint.debug(title)
  colorprint.debug('------------')
  let msg = yaml.safeDump(values)
  colorprint.debug(colors.blackBright(msg))
  colorprint.debug('')
  colorprint.debug('')
}

module.exports = print;
