TestProject Forum

Run Arrow functions with TestProject

Hello,
I would like to run an arrow function with Test Project.
My function:

const stringToNumber = string => parseFloat(string.split("€")[0].replace(' ', '').replace(',', '.'));
const number = stringToNumber("1 037,25 € Hors champ d'application de la TVA");

In this example, the function return the number 1037.25

To use this function with “TestProject”, I tested this:

I need the starting string that is stored in the {data_raw} parameter to be used for the function, and the returned result to be stored in {prime_simulator}.

How can I do ?

Hi,
You can use the following logic:

const stringToNumber = string => parseFloat(string.split("€")[0].replace(' ', '').replace(',', '.'));
return stringToNumber({Raw_Data});

You should not use the arguments field because your input string contains a comma which separates your input data to multiple arguments. arguments[0] arguments[1]… and so on. if you want to use the Args field and your data is not delimited by a comma you can do it like this: