varannotate=function(){varargs=Array.prototype.slice.call(arguments);varfn=args.pop();fn.$inject=args;returnfn;};// Current limitations:// - can't put into "function arg" comments// function /* (no parenthesis like this) */ (){}// function abc( /* xx (no parenthesis like this) */ a, b) {}//// Just put the comment before function or inside:// /* (((this is fine))) */ function(a, b) {}// function abc(a) { /* (((this is fine))) */}varFN_ARGS=/^function\s*[^\(]*\(\s*([^\)]*)\)/m;varFN_ARG=/\/\*([^\*]*)\*\//m;varparse=function(fn){if(typeoffn!=='function'){thrownewError('Can not annotate "'+fn+'". Expected a function!');}varmatch=fn.toString().match(FN_ARGS);returnmatch[1]&&match[1].split(',').map(function(arg){match=arg.match(FN_ARG);returnmatch?match[1].trim():arg.trim();})||[];};exports.annotate=annotate;exports.parse=parse;