超找函数参数名

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

 

posted @ 2017-11-25 17:33  halo-漾  阅读(104)  评论(0编辑  收藏  举报