convertInputValueToPublicodes

API / @publicodes/forms / convertInputValueToPublicodes

function convertInputValueToPublicodes<Name>(
   engine, 
   dottedName, 
   value): undefined | PublicodesExpression

Defined in: convertInputValueToPublicodes.ts:20

Convert input value from DOM change event to publicodes expression that can be used to update the engine situation.

This function has no side effect. It will NOT update the engine situation, it will only return the value.

Type Parameters

Type Parameter
Name extends string

Parameters

ParameterTypeDescription
engineEngine<Name>-
dottedNameName-
valueundefined | string | number | boolean: Value to convert.

Returns

undefined | PublicodesExpression

PublicodesExpression | undefined

See

updateSituationWithInputValue to update the engine situation.

Exemple

For example, a date input emit an event with a value of ‘2021-02-01’. We can use this function to convert it to a string in the format ‘01/02/2021’ which is the format used in publicodes.