"use strict";

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

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

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

  _path = function () {
    return data;
  };

  return data;
}

/**
 * get the current working dir name of file and file name.
 * @name fileInfo
 * @param relativePath
 * @returns {object}
 * @example
 * ```js
 *  currentDirName() // => 'bit'
 * ```
 */
function calculateFileInfo(relativePath) {
  const fileInfo = _path().default.parse(relativePath);

  const fullPath = _path().default.dirname(relativePath);

  const rootDir = _path().default.dirname(fullPath);

  const parentDir = _path().default.relative(rootDir, fullPath);

  return {
    PARENT: parentDir,
    FILE_NAME: fileInfo.name
  };
}