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

Function getter

test/angular/1.6/angular.js:2133–2150  ·  view source on GitHub ↗
(obj, path, bindFnToScope)

Source from the content-addressed store, hash-verified

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

Callers 1

$ControllerProviderFunction · 0.70

Calls 2

isFunctionFunction · 0.70
bindFunction · 0.70

Tested by

no test coverage detected