1 | STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/g
|
2 | ARGUMENT_NAMES = /([^\s,]+)/g
|
3 |
|
4 | module.exports = (func) ->
|
5 | throw new TypeError 'Argument must be a function' unless func instanceof Function
|
6 | fnStr = func.toString().replace(STRIP_COMMENTS, "")
|
7 | result = fnStr.slice(fnStr.indexOf("(") + 1, fnStr.indexOf(")")).match(ARGUMENT_NAMES)
|
8 | result = [] if result is null
|
9 | return result
|