MCPcopy
hub / github.com/ajv-validator/ajv / object

Method object

lib/compile/codegen/index.ts:551–563  ·  view source on GitHub ↗
(...keyValues: [Name | string, SafeExpr | string][])

Source from the content-addressed store, hash-verified

549
550 // returns code for object literal for the passed argument list of key-value pairs
551 object(...keyValues: [Name | string, SafeExpr | string][]): _Code {
552 const code: CodeItem[] = ["{"]
553 for (const [key, value] of keyValues) {
554 if (code.length > 1) code.push(",")
555 code.push(key)
556 if (key !== value || this.opts.es5) {
557 code.push(":")
558 addCodeArg(code, value)
559 }
560 }
561 code.push("}")
562 return new _Code(code)
563 }
564
565 // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
566 if(condition: Code | boolean, thenBody?: Block, elseBody?: Block): CodeGen {

Callers 3

callValidateCodeFunction · 0.80
errorObjectFunction · 0.80
codegen.spec.tsFile · 0.80

Calls 1

addCodeArgFunction · 0.90

Tested by

no test coverage detected