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

Function getter

test/angular/1.7/angular.js:2130–2147  ·  view source on GitHub ↗
(obj, path, bindFnToScope)

Source from the content-addressed store, hash-verified

2128 */
2129//TODO(misko): this function needs to be removed
2130function getter(obj, path, bindFnToScope) {
2131 if (!path) return obj;
2132 var keys = path.split('.');
2133 var key;
2134 var lastInstance = obj;
2135 var len = keys.length;
2136
2137 for (var i = 0; i < len; i++) {
2138 key = keys[i];
2139 if (obj) {
2140 obj = (lastInstance = obj)[key];
2141 }
2142 }
2143 if (!bindFnToScope && isFunction(obj)) {
2144 return bind(lastInstance, obj);
2145 }
2146 return obj;
2147}
2148
2149/**
2150 * Return the DOM siblings between the first and last node in the given array.

Callers 2

$ControllerProviderFunction · 0.70
angular.jsFile · 0.70

Calls 2

isFunctionFunction · 0.70
bindFunction · 0.70

Tested by

no test coverage detected