在 javascript/node.js 中是否有任何等效于 python 的 inspect.getargspec?
Is there any equivalent of python's inspect.getargspec in javascript/node.js?
我想获取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' ]
我想获取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' ]