"use strict";

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

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getRequireContextFilesMap = exports["default"] = void 0;

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

/**
 * ```
 * getRequireContextFilesMap(require.context(...)) => { './file.js': * }
 * ```
 */
var getRequireContextFilesMap = function getRequireContextFilesMap(requireContext) {
  return requireContext.keys().map(function (relativeFilePath) {
    return [relativeFilePath, requireContext(relativeFilePath)];
  }).reduce(function (acc, _ref) {
    var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
        relativeFilePath = _ref2[0],
        file = _ref2[1];

    acc[relativeFilePath] = file;
    return acc;
  }, {});
};

exports.getRequireContextFilesMap = getRequireContextFilesMap;
var _default = getRequireContextFilesMap;
exports["default"] = _default;