超找函数参数名

Posted halo-漾

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了超找函数参数名相关的知识,希望对你有一定的参考价值。

function argumentNames(fn){
    
    var found = /^[\s\(]*function[^(]*\(\s*([^)]*?)\s*\)/.exec(fn.toString());
    
    return found && found[1] ? found[1].split(/,\s*/) : [];
}

 

以上是关于超找函数参数名的主要内容,如果未能解决你的问题,请参考以下文章