roleElementMap.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
  3. var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
  4. _Object$defineProperty(exports, "__esModule", {
  5. value: true
  6. });
  7. exports.default = void 0;
  8. var _set = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set"));
  9. var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
  10. var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/keys"));
  11. var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/toConsumableArray"));
  12. var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
  13. var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/map"));
  14. var _rolesMap = _interopRequireDefault(require("./rolesMap"));
  15. var _context;
  16. var roleElementMap = new _map.default([]);
  17. (0, _forEach.default)(_context = (0, _toConsumableArray2.default)((0, _keys.default)(_rolesMap.default).call(_rolesMap.default))).call(_context, function (key) {
  18. var role = _rolesMap.default.get(key);
  19. if (role) {
  20. var _context2, _context3;
  21. (0, _forEach.default)(_context2 = (0, _concat.default)(_context3 = []).call(_context3, (0, _toConsumableArray2.default)(role.baseConcepts), (0, _toConsumableArray2.default)(role.relatedConcepts))).call(_context2, function (relation) {
  22. if (relation.module === 'HTML') {
  23. var concept = relation.concept;
  24. if (concept) {
  25. var relationConcepts = roleElementMap.get(key) || new _set.default([]);
  26. relationConcepts.add(concept);
  27. roleElementMap.set(key, relationConcepts);
  28. }
  29. }
  30. });
  31. }
  32. });
  33. var _default = roleElementMap;
  34. exports.default = _default;