"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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

function _path() {
  const data = _interopRequireDefault(require("path"));

  _path = function () {
    return data;
  };

  return data;
}

function _fsExtra() {
  const data = _interopRequireDefault(require("fs-extra"));

  _fsExtra = function () {
    return data;
  };

  return data;
}

/**
 * synchronous component for listing directory contents.
 * @param {string} dirPath target dir
 * @returns {string[]} array representing directory contents
 * @example
 * ```js
 *  listDirectories('/usr/local/foo/bar') //=> ['foo.html', 'bar.css']
 * ```
 */
function listDirectories(dirPath) {
  return _fsExtra().default.readdirSync(dirPath).filter(file => {
    return _fsExtra().default.statSync(_path().default.join(dirPath, file)).isDirectory();
  });
}