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

Function annotate

test/angular/1.6/angular.js:4264–4297  ·  view source on GitHub ↗
(fn, strictDi, name)

Source from the content-addressed store, hash-verified

4262}
4263
4264function annotate(fn, strictDi, name) {
4265 var $inject,
4266 argDecl,
4267 last;
4268
4269 if (typeof fn === 'function') {
4270 if (!($inject = fn.$inject)) {
4271 $inject = [];
4272 if (fn.length) {
4273 if (strictDi) {
4274 if (!isString(name) || !name) {
4275 name = fn.name || anonFn(fn);
4276 }
4277 throw $injectorMinErr('strictdi',
4278 '{0} is not using explicit annotation and cannot be invoked in strict mode', name);
4279 }
4280 argDecl = extractArgs(fn);
4281 forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) {
4282 arg.replace(FN_ARG, function(all, underscore, name) {
4283 $inject.push(name);
4284 });
4285 });
4286 }
4287 fn.$inject = $inject;
4288 }
4289 } else if (isArray(fn)) {
4290 last = fn.length - 1;
4291 assertArgFn(fn[last], 'fn');
4292 $inject = fn.slice(0, last);
4293 } else {
4294 assertArgFn(fn, 'fn', true);
4295 }
4296 return $inject;
4297}
4298
4299///////////////////////////////////////
4300

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