not.js 779 B

12345678910111213141516171819202122232425262728
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const util_1 = require("../../compile/util");
  4. const def = {
  5. keyword: "not",
  6. schemaType: ["object", "boolean"],
  7. trackErrors: true,
  8. code(cxt) {
  9. const { gen, schema, it } = cxt;
  10. if (util_1.alwaysValidSchema(it, schema)) {
  11. cxt.fail();
  12. return;
  13. }
  14. const valid = gen.name("valid");
  15. cxt.subschema({
  16. keyword: "not",
  17. compositeRule: true,
  18. createErrors: false,
  19. allErrors: false,
  20. }, valid);
  21. cxt.result(valid, () => cxt.error(), () => cxt.reset());
  22. },
  23. error: {
  24. message: "should NOT be valid",
  25. },
  26. };
  27. exports.default = def;
  28. //# sourceMappingURL=not.js.map