I currently have Error: 'string * number : operation unsupported for one or more operands types'
The reason
After investigating why we have this error, I found that decimal function is
const decimal = (n, scale) => n.toFixed(scale)toFixed is a formatting function, which has a sole purpose of converting a number to a string, formatting it using the specified number of decimals.
After checking the DMN Spec shared in the readme
decimal should return a number and not a string (at page 103, page 109 (10.3.2.3.1 number), page 113 (10.3.2.10 Mapping between FEEL and other domains), page 133 (Table 62: Semantics of numeric functions))
Hi,
Currently I try to do the following thing :
Expected behaviour
I expect to have
447
in the resultCurrent behaviour
I currently have
Error: 'string * number : operation unsupported for one or more operands types'
The reason
After investigating why we have this error, I found that decimal function is
const decimal = (n, scale) => n.toFixed(scale)
toFixed
is a formatting function, which has a sole purpose of converting a number to a string, formatting it using the specified number of decimals.Proposed solution
By changing the decimal function to :
If you are agree with this solution, I could make a PR. Let me know thanks !