UNPKG

lenye_base

Version:

基础方法

12 lines (9 loc) 253 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;