'use strict';

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

var _path = require('path');

var _path2 = _interopRequireDefault(_path);

var _recursiveFolder = require('./recursiveFolder');

var _recursiveFolder2 = _interopRequireDefault(_recursiveFolder);

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

function folders(obj, index, link, translate) {
  var res;
  if (obj.length > 0) {
    if (link != null && link !== 'null') {
      var links = link.replace(/^\//, '').split(_path2.default.sep);
      links.pop();
      res = (0, _recursiveFolder2.default)(obj, 1, '', links, false, translate);
    } else {
      res = (0, _recursiveFolder2.default)(obj, 1, '', null, false, translate);
    }
  }
  return res;
}