MCPcopy Index your code
hub / github.com/angular-ui/ui-router / annotate

Function annotate

test/angular/1.5/angular.js:3992–4025  ·  view source on GitHub ↗
(fn, strictDi, name)

Source from the content-addressed store, hash-verified

3990}
3991
3992function annotate(fn, strictDi, name) {
3993 var $inject,
3994 argDecl,
3995 last;
3996
3997 if (typeof fn === 'function') {
3998 if (!($inject = fn.$inject)) {
3999 $inject = [];
4000 if (fn.length) {
4001 if (strictDi) {
4002 if (!isString(name) || !name) {
4003 name = fn.name || anonFn(fn);
4004 }
4005 throw $injectorMinErr('strictdi',
4006 '{0} is not using explicit annotation and cannot be invoked in strict mode', name);
4007 }
4008 argDecl = extractArgs(fn);
4009 forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) {
4010 arg.replace(FN_ARG, function(all, underscore, name) {
4011 $inject.push(name);
4012 });
4013 });
4014 }
4015 fn.$inject = $inject;
4016 }
4017 } else if (isArray(fn)) {
4018 last = fn.length - 1;
4019 assertArgFn(fn[last], 'fn');
4020 $inject = fn.slice(0, last);
4021 } else {
4022 assertArgFn(fn, 'fn', true);
4023 }
4024 return $inject;
4025}
4026
4027///////////////////////////////////////
4028

Callers

nothing calls this directly

Calls 6

isArrayFunction · 0.85
isStringFunction · 0.70
anonFnFunction · 0.70
extractArgsFunction · 0.70
forEachFunction · 0.70
assertArgFnFunction · 0.70

Tested by

no test coverage detected