aboutsummaryrefslogtreecommitdiff
path: root/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js
diff options
context:
space:
mode:
authorNevena Bojovic <nenabojov@gmail.com>2022-03-01 20:05:50 +0100
committerNevena Bojovic <nenabojov@gmail.com>2022-03-01 20:05:50 +0100
commit291803c31f829fe0d32bb3207bc11def95a7408c (patch)
treec7d43107d79291b19d8c9eceefbe91c9f9a52acf /sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js
parent1fa69862057db4db53cfda5be9c24b4228ef63f7 (diff)
Urađena test aplikacija. Povezan front i back.
Diffstat (limited to 'sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js')
-rw-r--r--sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js65
1 files changed, 65 insertions, 0 deletions
diff --git a/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js b/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js
new file mode 100644
index 00000000..ad298499
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js
@@ -0,0 +1,65 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+const codegen_1 = require("../../compile/codegen");
+const util_1 = require("../../compile/util");
+const names_1 = require("../../compile/names");
+const error = {
+ message: "must NOT have unevaluated properties",
+ params: ({ params }) => (0, codegen_1._) `{unevaluatedProperty: ${params.unevaluatedProperty}}`,
+};
+const def = {
+ keyword: "unevaluatedProperties",
+ type: "object",
+ schemaType: ["boolean", "object"],
+ trackErrors: true,
+ error,
+ code(cxt) {
+ const { gen, schema, data, errsCount, it } = cxt;
+ /* istanbul ignore if */
+ if (!errsCount)
+ throw new Error("ajv implementation error");
+ const { allErrors, props } = it;
+ if (props instanceof codegen_1.Name) {
+ gen.if((0, codegen_1._) `${props} !== true`, () => gen.forIn("key", data, (key) => gen.if(unevaluatedDynamic(props, key), () => unevaluatedPropCode(key))));
+ }
+ else if (props !== true) {
+ gen.forIn("key", data, (key) => props === undefined
+ ? unevaluatedPropCode(key)
+ : gen.if(unevaluatedStatic(props, key), () => unevaluatedPropCode(key)));
+ }
+ it.props = true;
+ cxt.ok((0, codegen_1._) `${errsCount} === ${names_1.default.errors}`);
+ function unevaluatedPropCode(key) {
+ if (schema === false) {
+ cxt.setParams({ unevaluatedProperty: key });
+ cxt.error();
+ if (!allErrors)
+ gen.break();
+ return;
+ }
+ if (!(0, util_1.alwaysValidSchema)(it, schema)) {
+ const valid = gen.name("valid");
+ cxt.subschema({
+ keyword: "unevaluatedProperties",
+ dataProp: key,
+ dataPropType: util_1.Type.Str,
+ }, valid);
+ if (!allErrors)
+ gen.if((0, codegen_1.not)(valid), () => gen.break());
+ }
+ }
+ function unevaluatedDynamic(evaluatedProps, key) {
+ return (0, codegen_1._) `!${evaluatedProps} || !${evaluatedProps}[${key}]`;
+ }
+ function unevaluatedStatic(evaluatedProps, key) {
+ const ps = [];
+ for (const p in evaluatedProps) {
+ if (evaluatedProps[p] === true)
+ ps.push((0, codegen_1._) `${key} !== ${p}`);
+ }
+ return (0, codegen_1.and)(...ps);
+ }
+ },
+};
+exports.default = def;
+//# sourceMappingURL=unevaluatedProperties.js.map \ No newline at end of file