Is there any parser for JavaScript file? I want to get/grep the argument list for a parameter.
As an example:
function a(){
}
function b(){
}
function body_4(chk, ctx) {
ctx = ctx.shiftBlocks(blocks);
//WANT TO GET THE #3rd parameter JSON object.
return chk.partial("components/TextInput/textInput", ctx, {
"className": "firstName",
"name": "firstName",
"id": "firstName",
"placeholder": "Please enter first name",
"maxlength": "30",
"required": "required",
"errorMessage": "Please enter a valid first name",
"value": body_5
}).partial("components/TextInput/textInput", ctx, {
"className": "lastName",
"name": "lastName",
"id": "lastName",
"placeholder": "Please enter last name",
"maxlength": "30",
"required": "required",
"errorMessage": "Please enter a valid last name",
"value": body_6
});
}
WANT TO GET THE #3rd parameter JSON object where the 1st argument is:"components/TextInput/textInput"
Any Node module or any kind of javaScript Library would do..
The Output I am looking for is:
{
"className": "lastName",
"name": "lastName",
"id": "lastName",
"placeholder": "Please enter last name",
"maxlength": "30",
"required": "required",
"errorMessage": "Please enter a valid last name",
"value": body_6
}