Skip to content

This site describes solve-engine as it is on main: 2.43.0, which npm does not have yet. npm installs 2.40.0, so a page may show an answer that version does not give yet.

checkExpressionComplexity

function checkExpressionComplexity(tokens, config): {
complexityScore: number;
engineError?: EngineError;
errorMessage?: string;
passed: boolean;
};

Defined in: packages/engine/src/engine/ExpressionEngineSafety.ts:84

Score expression complexity based on token count, function calls, and nesting depth. Returns the complexity score and whether it exceeds the configured maximum.

ParameterType
tokensToken[]
configValidationConfig
{
complexityScore: number;
engineError?: EngineError;
errorMessage?: string;
passed: boolean;
}
complexityScore: number;
optional engineError?: EngineError;
optional errorMessage?: string;
passed: boolean;