MCPcopy
hub / github.com/angular-ui/ui-router / annotate

Function annotate

test/angular/1.7/angular.js:4292–4325  ·  view source on GitHub ↗
(fn, strictDi, name)

Source from the content-addressed store, hash-verified

4290}
4291
4292function annotate(fn, strictDi, name) {
4293 var $inject,
4294 argDecl,
4295 last;
4296
4297 if (typeof fn === 'function') {
4298 if (!($inject = fn.$inject)) {
4299 $inject = [];
4300 if (fn.length) {
4301 if (strictDi) {
4302 if (!isString(name) || !name) {
4303 name = fn.name || anonFn(fn);
4304 }
4305 throw $injectorMinErr('strictdi',
4306 '{0} is not using explicit annotation and cannot be invoked in strict mode', name);
4307 }
4308 argDecl = extractArgs(fn);
4309 forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) {
4310 arg.replace(FN_ARG, function(all, underscore, name) {
4311 $inject.push(name);
4312 });
4313 });
4314 }
4315 fn.$inject = $inject;
4316 }
4317 } else if (isArray(fn)) {
4318 last = fn.length - 1;
4319 assertArgFn(fn[last], 'fn');
4320 $inject = fn.slice(0, last);
4321 } else {
4322 assertArgFn(fn, 'fn', true);
4323 }
4324 return $inject;
4325}
4326
4327///////////////////////////////////////
4328

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