MCPcopy Create free account
hub / github.com/OpenReservation/OpenReservation / annotate

Function annotate

OpenReservation/wwwroot/Scripts/angular.js:3837–3873  ·  view source on GitHub ↗
(fn, strictDi, name)

Source from the content-addressed store, hash-verified

3835 }
3836
3837 function annotate(fn, strictDi, name) {
3838 var $inject,
3839 argDecl,
3840 last;
3841
3842 if (typeof fn === 'function') {
3843 if (!($inject = fn.$inject)) {
3844 $inject = [];
3845 if (fn.length) {
3846 if (strictDi) {
3847 if (!isString(name) || !name) {
3848 name = fn.name || anonFn(fn);
3849 }
3850 throw $injectorMinErr('strictdi',
3851 '{0} is not using explicit annotation and cannot be invoked in strict mode',
3852 name);
3853 }
3854 argDecl = extractArgs(fn);
3855 forEach(argDecl[1].split(FN_ARG_SPLIT),
3856 function (arg) {
3857 arg.replace(FN_ARG,
3858 function (all, underscore, name) {
3859 $inject.push(name);
3860 });
3861 });
3862 }
3863 fn.$inject = $inject;
3864 }
3865 } else if (isArray(fn)) {
3866 last = fn.length - 1;
3867 assertArgFn(fn[last], 'fn');
3868 $inject = fn.slice(0, last);
3869 } else {
3870 assertArgFn(fn, 'fn', true);
3871 }
3872 return $inject;
3873 }
3874
3875 ///////////////////////////////////////
3876

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected