telefonicasc / tcjexl

Recubrimiento de la librería de jexl incluyendo un conjunto de transformaciones por defecto
GNU Affero General Public License v3.0
0 stars 0 forks source link

Support "toFixed" #15

Open danielvillalbamota opened 4 months ago

danielvillalbamota commented 4 months ago

Currently expression round works rounding to integer and decimal.

According to other usages of jexl (javascript) we have toFixed to round decimals, so we could also implement toFixed as

super().add_transform("toFixed", lambda x, decimals: round(x, decimals)).

Moreover, should we limit the usage of round expression to round integer? This would be using the python function "round" without using the second parameter (ndigits) https://docs.python.org/3/library/functions.html#round

fgalan commented 4 months ago

If we change existing transformation we have to analyse first its current usage, to detect potential backward compatibility problems.