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

Function annotate

lib/test/angular/1.8.0/angular.js:4357–4390  ·  view source on GitHub ↗
(fn, strictDi, name)

Source from the content-addressed store, hash-verified

4355}
4356
4357function annotate(fn, strictDi, name) {
4358 var $inject,
4359 argDecl,
4360 last;
4361
4362 if (typeof fn === 'function') {
4363 if (!($inject = fn.$inject)) {
4364 $inject = [];
4365 if (fn.length) {
4366 if (strictDi) {
4367 if (!isString(name) || !name) {
4368 name = fn.name || anonFn(fn);
4369 }
4370 throw $injectorMinErr('strictdi',
4371 '{0} is not using explicit annotation and cannot be invoked in strict mode', name);
4372 }
4373 argDecl = extractArgs(fn);
4374 forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) {
4375 arg.replace(FN_ARG, function(all, underscore, name) {
4376 $inject.push(name);
4377 });
4378 });
4379 }
4380 fn.$inject = $inject;
4381 }
4382 } else if (isArray(fn)) {
4383 last = fn.length - 1;
4384 assertArgFn(fn[last], 'fn');
4385 $inject = fn.slice(0, last);
4386 } else {
4387 assertArgFn(fn, 'fn', true);
4388 }
4389 return $inject;
4390}
4391
4392///////////////////////////////////////
4393

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected