"use strict";

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

var _removeHashFromFileName = require("./removeHashFromFileName");

function addFilesNamesToManifestJson({
  manifestJson,
  option,
  assets,
  hashDigestLength
}) {
  const json = manifestJson;
  Object.keys(assets).forEach(filename => {
    if (option.test(filename)) {
      const filenameNameWithoutHash = (0, _removeHashFromFileName.removeHashFromFileName)(filename, hashDigestLength);
      json[filenameNameWithoutHash] = filename;
    }
  });
  return json;
}