javascript / node.js中是否有python的inspect.getargspec的等价物?
我想获得Function
的参数名称列表,例如:
var f = (a, b, c) => console.log(a, b, c); var [fargs] = something.like.inspect.getargspec(f); console.log(fargs); // ['a', 'b', 'c']
如果你正在使用Node并且需要参数名称,请查看introspect
NPM模块:
> var introspect = require('introspect') > var f = (a, b, c) => console.log(a, b, c); > console.log(introspect(f)) [ 'a', 'b', 'c' ]