Lines 2476-2516javascript
2476 } : { ref: sch.schema }),
2478 ValidationError: _ValidationError,
2482 baseId: sch.baseId || rootId,
2483 schemaPath: codegen_1.nil,
2484 errSchemaPath: sch.schemaPath || (this.opts.jtd ? "" : "#"),
2485 errorPath: (0, codegen_1._)`""`,
2491 this._compilations.add(sch);
2492 (0, validate_1.validateFunctionCode)(schemaCxt);
2493 gen.optimize(this.opts.code.optimize);
2494 const validateCode = gen.toString();
2495 sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${validateCode}`;
2496 if (this.opts.code.process) sourceCode = this.opts.code.process(sourceCode, sch);
2497 const validate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode)(this, this.scope.get());
2498 this.scope.value(validateName, { ref: validate });
LowEval
Package source references a known benign dynamic code generation pattern.
dist/json-schema-pcL1TeZs.cjsView on unpkg · L2496 2499 validate.errors = null;
2500 validate.schema = sch.schema;
2501 validate.schemaEnv = sch;
2502 if (sch.$async) validate.$async = true;
2503 if (this.opts.code.source === true) validate.source = {
2506 scopeValues: gen._values
2508 if (this.opts.unevaluated) {
2509 const { props, items } = schemaCxt;
2510 validate.evaluated = {
2511 props: props instanceof codegen_1.Name ? void 0 : props,
2512 items: items instanceof codegen_1.Name ? void 0 : items,
2513 dynamicProps: props instanceof codegen_1.Name,
2514 dynamicItems: items instanceof codegen_1.Name
2516 if (validate.source) validate.source.evaluated = (0, codegen_1.stringify)(validate.evaluated);