简体   繁体   中英

See a function signature in Node.js?

Is there a way to see just the function signature in Node.js? I'm aware of fn.toString() but don't want all the code, just the signature.

var source = fn.toString();
var signature = source.substring(0, source.indexOf('{') - 1);

is probably the closest you'll get; fall back on fn.length for native methods.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM