feat(assertArgFn): should support array annotated fns

This commit is contained in:
Igor Minar 2012-03-26 12:21:42 -07:00
parent 74c84501ed
commit 4b8d926062

View file

@ -959,7 +959,11 @@ function assertArg(arg, name, reason) {
return arg;
}
function assertArgFn(arg, name) {
function assertArgFn(arg, name, acceptArrayAnnotation) {
if (acceptArrayAnnotation && isArray(arg)) {
arg = arg[arg.length - 1];
}
assertArg(isFunction(arg), name, 'not a function, got ' +
(arg && typeof arg == 'object' ? arg.constructor.name || 'Object' : typeof arg));
return arg;