map.js 929 B

123456789101112131415161718192021222324252627282930
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.parseMapDef = void 0;
  4. const parseDef_1 = require("../parseDef.js");
  5. const record_1 = require("./record.js");
  6. function parseMapDef(def, refs) {
  7. if (refs.mapStrategy === 'record') {
  8. return (0, record_1.parseRecordDef)(def, refs);
  9. }
  10. const keys = (0, parseDef_1.parseDef)(def.keyType._def, {
  11. ...refs,
  12. currentPath: [...refs.currentPath, 'items', 'items', '0'],
  13. }) || {};
  14. const values = (0, parseDef_1.parseDef)(def.valueType._def, {
  15. ...refs,
  16. currentPath: [...refs.currentPath, 'items', 'items', '1'],
  17. }) || {};
  18. return {
  19. type: 'array',
  20. maxItems: 125,
  21. items: {
  22. type: 'array',
  23. items: [keys, values],
  24. minItems: 2,
  25. maxItems: 2,
  26. },
  27. };
  28. }
  29. exports.parseMapDef = parseMapDef;
  30. //# sourceMappingURL=map.js.map