'use strict';

var makeDir = require('../../../../_virtual/make-dir.js');
require('../fs/index.js');
require('./utils.js');
var index = require('../../../../_virtual/index20.js');
var utils = require('../../../../_virtual/utils2.js');

const fs = index.__exports;
const { checkPath } = utils.__exports;

const getMode = options => {
  const defaults = { mode: 0o777 };
  if (typeof options === 'number') return options
  return ({ ...defaults, ...options }).mode
};

makeDir.__exports.makeDir = async (dir, options) => {
  checkPath(dir);

  return fs.mkdir(dir, {
    mode: getMode(options),
    recursive: true
  })
};

makeDir.__exports.makeDirSync = (dir, options) => {
  checkPath(dir);

  return fs.mkdirSync(dir, {
    mode: getMode(options),
    recursive: true
  })
};

module.exports = makeDir.__exports;
