MCPcopy Index your code
hub / github.com/json-editor/json-editor / if

Method if

docs/scripts/ajv-validator.js:1167–1179  ·  view source on GitHub ↗
(condition, thenBody, elseBody)

Source from the content-addressed store, hash-verified

1165 }
1166 // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
1167 if(condition, thenBody, elseBody) {
1168 this._blockNode(new If(condition));
1169 if (thenBody && elseBody) {
1170 this.code(thenBody).else().code(elseBody).endIf();
1171 }
1172 else if (thenBody) {
1173 this.code(thenBody).endIf();
1174 }
1175 else if (elseBody) {
1176 throw new Error('CodeGen: "else" body without "then" body');
1177 }
1178 return this;
1179 }
1180 // `else if` clause - invalid without `if` or after `else` clauses
1181 elseIf(condition) {
1182 return this._elseNode(new If(condition));

Callers 15

resetErrorsCountFunction · 0.45
extendErrorsFunction · 0.45
addErrorFunction · 0.45
ajv-validator.jsFile · 0.45
coerceAndCheckDataTypeFunction · 0.45
coerceDataFunction · 0.45
assignParentDataFunction · 0.45
assignDefaultFunction · 0.45
destructureValCxtES5Function · 0.45
resetEvaluatedFunction · 0.45
returnResultsFunction · 0.45
groupKeywordsFunction · 0.45

Calls 4

_blockNodeMethod · 0.95
codeMethod · 0.95
endIfMethod · 0.80
elseMethod · 0.80

Tested by

no test coverage detected