获取方法和参数的JavaScript文件解析器
有JavaScript文件的解析器吗? 我想获取/grep参数的参数列表 例如:获取方法和参数的JavaScript文件解析器,javascript,node.js,Javascript,Node.js,有JavaScript文件的解析器吗? 我想获取/grep参数的参数列表 例如: 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/text
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
});
}
想要获取第三个参数JSON对象,其中第一个参数是:“components/TextInput/TextInput”
任何节点模块或任何类型的javaScript库都可以
我想要的输出是:
{
"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
}
尝试使用正则表达式。比如: (}).partial(“components/TextInput/TextInput”,ctx,)({)([\s\s]+)(});)+ 用于测试regex签出站点 第三组是([\s\s]+)对象的内容(JSON)/ 您还可以检查以下内容: 您可以尝试使用