"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = makeDir;

var _fs = _interopRequireDefault(require("fs"));

var _path2 = _interopRequireDefault(require("path"));

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

/**
 * Create directory or use existing one
 * @param {string} path directory path to create new directory
 * @param {string} dirname new directory name
 * @returns {string} full new directory path
 */
function makeDir(path, dirname) {
  const fullPath = _path2.default.join(path.trim(), dirname.trim());

  try {
    _fs.default.existsSync(fullPath) || _fs.default.mkdirSync(fullPath);
  } catch (err) {
    throw err;
  }

  return fullPath;
}