MCPcopy
hub / github.com/Postcatlab/postcat / annotate

Function annotate

src/workbench/browser/src/ng1/lib/angular/angular.js:4455–4488  ·  view source on GitHub ↗
(fn, strictDi, name)

Source from the content-addressed store, hash-verified

4453 }
4454
4455 function annotate(fn, strictDi, name) {
4456 var $inject,
4457 argDecl,
4458 last;
4459
4460 if (typeof fn === 'function') {
4461 if (!($inject = fn.$inject)) {
4462 $inject = [];
4463 if (fn.length) {
4464 if (strictDi) {
4465 if (!isString(name) || !name) {
4466 name = fn.name || anonFn(fn);
4467 }
4468 throw $injectorMinErr('strictdi',
4469 '{0} is not using explicit annotation and cannot be invoked in strict mode', name);
4470 }
4471 argDecl = extractArgs(fn);
4472 forEach(argDecl[1].split(FN_ARG_SPLIT), function (arg) {
4473 arg.replace(FN_ARG, function (all, underscore, name) {
4474 $inject.push(name);
4475 });
4476 });
4477 }
4478 fn.$inject = $inject;
4479 }
4480 } else if (isArray(fn)) {
4481 last = fn.length - 1;
4482 assertArgFn(fn[last], 'fn');
4483 $inject = fn.slice(0, last);
4484 } else {
4485 assertArgFn(fn, 'fn', true);
4486 }
4487 return $inject;
4488 }
4489
4490 ///////////////////////////////////////
4491

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected