Lines 3832-3872javascript
3832 } : { ref: sch.schema }),
3834 ValidationError: _ValidationError,
3838 baseId: sch.baseId || rootId,
3839 schemaPath: codegen_1.nil,
3840 errSchemaPath: sch.schemaPath || (this.opts.jtd ? "" : "#"),
3841 errorPath: (0, codegen_1._)`""`,
3847 this._compilations.add(sch);
3848 (0, validate_1.validateFunctionCode)(schemaCxt);
3849 gen.optimize(this.opts.code.optimize);
3850 const validateCode = gen.toString();
3851 sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${validateCode}`;
3852 if (this.opts.code.process) sourceCode = this.opts.code.process(sourceCode, sch);
3853 const validate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode)(this, this.scope.get());
3854 this.scope.value(validateName, { ref: validate });
LowEval
Package source references a known benign dynamic code generation pattern.
dist/schema-Ba6HLBWs-DrPMJ7GF.cjsView on unpkg · L3852 3855 validate.errors = null;
3856 validate.schema = sch.schema;
3857 validate.schemaEnv = sch;
3858 if (sch.$async) validate.$async = true;
3859 if (this.opts.code.source === true) validate.source = {
3862 scopeValues: gen._values
3864 if (this.opts.unevaluated) {
3865 const { props, items } = schemaCxt;
3866 validate.evaluated = {
3867 props: props instanceof codegen_1.Name ? void 0 : props,
3868 items: items instanceof codegen_1.Name ? void 0 : items,
3869 dynamicProps: props instanceof codegen_1.Name,
3870 dynamicItems: items instanceof codegen_1.Name
3872 if (validate.source) validate.source.evaluated = (0, codegen_1.stringify)(validate.evaluated);