阅读类库代码dump()
<pre><code class="language-javascript">console.dump = function(o, exclude = []){
// exclude['number','string','boolean','null','undefined','object','function']
let functions = []
for(let k in o) {
let type = typeof o[k]
if (exclude.includes(type)) continue
if(type == 'function') {
let mathes = /[^(]+\(([^)]*)?\)/gm.exec(Function.prototype.toString.call(o[k]));
functions.push(mathes['input'])
} else {
console.log(k, type, o[k])
}
}
console.table(functions)
}</code></pre>