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

Function annotate

lib/test/angular/1.7.0/angular.js:4242–4275  ·  view source on GitHub ↗
(fn, strictDi, name)

Source from the content-addressed store, hash-verified

4240}
4241
4242function annotate(fn, strictDi, name) {
4243 var $inject,
4244 argDecl,
4245 last;
4246
4247 if (typeof fn === 'function') {
4248 if (!($inject = fn.$inject)) {
4249 $inject = [];
4250 if (fn.length) {
4251 if (strictDi) {
4252 if (!isString(name) || !name) {
4253 name = fn.name || anonFn(fn);
4254 }
4255 throw $injectorMinErr('strictdi',
4256 '{0} is not using explicit annotation and cannot be invoked in strict mode', name);
4257 }
4258 argDecl = extractArgs(fn);
4259 forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) {
4260 arg.replace(FN_ARG, function(all, underscore, name) {
4261 $inject.push(name);
4262 });
4263 });
4264 }
4265 fn.$inject = $inject;
4266 }
4267 } else if (isArray(fn)) {
4268 last = fn.length - 1;
4269 assertArgFn(fn[last], 'fn');
4270 $inject = fn.slice(0, last);
4271 } else {
4272 assertArgFn(fn, 'fn', true);
4273 }
4274 return $inject;
4275}
4276
4277///////////////////////////////////////
4278

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