1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
| "use strict";
| Object.defineProperty(exports, "__esModule", { value: true });
| function getRangeDef(keyword) {
| return () => ({
| keyword,
| type: "number",
| schemaType: "array",
| macro: function ([min, max]) {
| validateRangeSchema(min, max);
| return keyword === "range"
| ? { minimum: min, maximum: max }
| : { exclusiveMinimum: min, exclusiveMaximum: max };
| },
| metaSchema: {
| type: "array",
| minItems: 2,
| maxItems: 2,
| items: { type: "number" },
| },
| });
| function validateRangeSchema(min, max) {
| if (min > max || (keyword === "exclusiveRange" && min === max)) {
| throw new Error("There are no numbers in range");
| }
| }
| }
| exports.default = getRangeDef;
| //# sourceMappingURL=_range.js.map
|
|