utils.js 779 B

123456789101112131415
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.enumToMap = void 0;
  4. function enumToMap(obj, filter = [], exceptions = []) {
  5. var _a, _b;
  6. const emptyFilter = ((_a = filter === null || filter === void 0 ? void 0 : filter.length) !== null && _a !== void 0 ? _a : 0) === 0;
  7. const emptyExceptions = ((_b = exceptions === null || exceptions === void 0 ? void 0 : exceptions.length) !== null && _b !== void 0 ? _b : 0) === 0;
  8. return Object.fromEntries(Object.entries(obj).filter(([, value]) => {
  9. return (typeof value === 'number' &&
  10. (emptyFilter || filter.includes(value)) &&
  11. (emptyExceptions || !exceptions.includes(value)));
  12. }));
  13. }
  14. exports.enumToMap = enumToMap;
  15. //# sourceMappingURL=utils.js.map