(
{schemaCode, data, it: {gen, topSchemaRef, schemaPath, errorPath}, it}: KeywordCxt,
func: Code,
context: Code,
passSchema?: boolean
)
| 73 | } |
| 74 | |
| 75 | export function callValidateCode( |
| 76 | {schemaCode, data, it: {gen, topSchemaRef, schemaPath, errorPath}, it}: KeywordCxt, |
| 77 | func: Code, |
| 78 | context: Code, |
| 79 | passSchema?: boolean |
| 80 | ): Code { |
| 81 | const dataAndSchema = passSchema ? _`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data |
| 82 | const valCxt: [Name, Code | number][] = [ |
| 83 | [N.instancePath, strConcat(N.instancePath, errorPath)], |
| 84 | [N.parentData, it.parentData], |
| 85 | [N.parentDataProperty, it.parentDataProperty], |
| 86 | [N.rootData, N.rootData], |
| 87 | ] |
| 88 | if (it.opts.dynamicRef) valCxt.push([N.dynamicAnchors, N.dynamicAnchors]) |
| 89 | const args = _`${dataAndSchema}, ${gen.object(...valCxt)}` |
| 90 | return context !== nil ? _`${func}.call(${context}, ${args})` : _`${func}(${args})` |
| 91 | } |
| 92 | |
| 93 | const newRegExp = _`new RegExp` |
| 94 |
no test coverage detected
searching dependent graphs…