UNPKG

bbo

Version:

bbo is a utility library of zero dependencies for javascript.

12 lines (9 loc) 250 B
'use strict'; /** * Gets all the formal parameter names of a function * https://www.zhihu.com/question/28912825 */ function paramsName(fn) { return /\(\s*([\s\S]*?)\s*\)/.exec(fn.toString())[1].split(/\s*,\s*/); } module.exports = paramsName;