-1

I want to check parameters of a function to be in a range with babel. I mean I want to change the following code:

function(arg1, arg2)
{
     body of function
}

to this code:

function checkRange(argument)
{
       some checking
}
function(arg1, arg2)
{
     checkRange(arg1);
     checkRange(arg2);
     body of function
}

how can I do this with Babel? I read this tutorial: https://lihautan.com/step-by-step-guide-for-writing-a-babel-transformation/ and I also read a number of examples in https://github.com/babel/babel/tree/master/packages and more and more. but I'm very beginner in Babel

saha
  • 23
  • 5
  • welcome! you read the tutorial and the examples. what did you learn from it? what did not work, precisely? – jasie Apr 19 '22 at 12:42
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Apr 19 '22 at 12:42

1 Answers1

0

you can use inner function like this :

function(arg1, arg2)
{
 function checkRange(argument)
 {
   some checking
 }

 checkRange(arg1);
 checkRange(arg2);
 body of function
}
zek
  • 1
  • 1