'use strict';

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

var _fs;

function _load_fs() {
  return _fs = _interopRequireDefault(require('fs'));
}

var _path;

function _load_path() {
  return _path = _interopRequireWildcard(require('path'));
}

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

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

function rmDir(path) {
  if ((_fs || _load_fs()).default.existsSync(path)) {
    (_fs || _load_fs()).default.readdirSync(path).forEach(function (file) {
      var curPath = (_path || _load_path()).join(path, file);
      if ((_fs || _load_fs()).default.lstatSync(curPath).isDirectory()) {
        rmDir(curPath);
      } else {
        (_fs || _load_fs()).default.unlinkSync(curPath);
      }
    });
    (_fs || _load_fs()).default.rmdirSync(path);
  }
}