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

Function getter

test/angular/1.4/angular.js:1866–1883  ·  view source on GitHub ↗
(obj, path, bindFnToScope)

Source from the content-addressed store, hash-verified

1864 */
1865//TODO(misko): this function needs to be removed
1866function getter(obj, path, bindFnToScope) {
1867 if (!path) return obj;
1868 var keys = path.split('.');
1869 var key;
1870 var lastInstance = obj;
1871 var len = keys.length;
1872
1873 for (var i = 0; i < len; i++) {
1874 key = keys[i];
1875 if (obj) {
1876 obj = (lastInstance = obj)[key];
1877 }
1878 }
1879 if (!bindFnToScope && isFunction(obj)) {
1880 return bind(lastInstance, obj);
1881 }
1882 return obj;
1883}
1884
1885/**
1886 * 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