Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.subscribe((result: SandboxResponse) => {
if (result.error === undefined) {
if (result.output === "undefined" || result.output === "null") {
this.newValueStream.next(new ExpressionModel({
value: "",
evaluatedValue: "",
}));
} else {
const newExpression = new ExpressionModel({});
newExpression.setValueToExpression(this.codeToEvaluate);
newExpression.setEvaluatedValue(result.output);
this.newValueStream.next(newExpression)
}
}
});
}
.subscribe((value: string) => {
this.updateExpressionValue(new ExpressionModel(value));
})
);
writeValue(obj: ExpressionModel): void {
if (obj) {
this.model = obj;
this.isExpr = obj.isExpression;
} else {
this.model = new ExpressionModel("");
this.isExpr = this.model.isExpression;
}
}
private crateExpressionInput(): void {
if (this.formGroup.contains("expressionField")) {
return;
}
this.formGroup.controls["radioButtonControl"].setValue("");
this.expressionModel = new ExpressionModel("");
this.formGroup.addControl(
"expressionField",
new FormControl(this.expressionModel.serialize(), Validators.compose([Validators.required, Validators.minLength(1)]))
);
this.subs.push(
this.formGroup.controls["expressionField"].valueChanges
.debounceTime(300)
.subscribe((value: string) => {
this.updateExpressionValue(new ExpressionModel(value));
})
);
}
.subscribe((result: SandboxResponse) => {
if (result.error === undefined) {
if (result.output === "undefined" || result.output === "null") {
this.newValueStream.next(new ExpressionModel({
value: "",
evaluatedValue: "",
}));
} else {
const newExpression = new ExpressionModel({});
newExpression.setValueToExpression(this.codeToEvaluate);
newExpression.setEvaluatedValue(result.output);
this.newValueStream.next(newExpression)
}
}
});
}