How to get code as string between {} of arrow function ?
var myFn=(arg1,..,argN)=>{
         /**
          *Want to parse
          * ONLY which is between { and }
          * of arrow function 
         */ 
 };
If it is easy to parse body of simple function : myFn.toString().match(/function[^{]+\{([\s\S]*)\}$/)[1]; is enough . However, Arrow function does not contains function keyword in its definition .
 
Aucun commentaire:
Enregistrer un commentaire