MCPcopy Create free account
hub / github.com/cafebazaar/blacksmith / getter

Function getter

web/static/bower_components/angular/angular.js:1830–1847  ·  view source on GitHub ↗
(obj, path, bindFnToScope)

Source from the content-addressed store, hash-verified

1828 */
1829//TODO(misko): this function needs to be removed
1830function getter(obj, path, bindFnToScope) {
1831 if (!path) return obj;
1832 var keys = path.split('.');
1833 var key;
1834 var lastInstance = obj;
1835 var len = keys.length;
1836
1837 for (var i = 0; i < len; i++) {
1838 key = keys[i];
1839 if (obj) {
1840 obj = (lastInstance = obj)[key];
1841 }
1842 }
1843 if (!bindFnToScope && isFunction(obj)) {
1844 return bind(lastInstance, obj);
1845 }
1846 return obj;
1847}
1848
1849/**
1850 * Return the DOM siblings between the first and last node in the given array.

Callers 2

$ControllerProviderFunction · 0.85
attr.jsFile · 0.85

Calls 2

isFunctionFunction · 0.85
bindFunction · 0.85

Tested by

no test coverage detected