PublicodesExpression

API / publicodes / PublicodesExpression

type PublicodesExpression: string | Record<string, unknown> | number;

A publicodes expression that can be evaluated by the Engine.

It can be parsed to an ASTNode with the parseExpression function or evaluated directly by the engine with the Engine.evaluate method.

Example

const expression1 = 'prix du panier' // Rule name
const expression2 = 'prix du panier + 20' // Operation
const expression3 = { valeur: "salaire brut", unité: "€/an", "arrondi": "oui" } // Mecanism

Defined in

packages/core/src/index.ts:54