habitica/common/script/libs/dotGet.js

10 lines
231 B
JavaScript
Raw Normal View History

2016-03-08 17:58:39 +00:00
import _ from 'lodash';
module.exports = function(obj, path) {
return _.reduce(path.split('.'), ((function(_this) {
return function(curr, next) {
return curr != null ? curr[next] : void 0;
};
})(this)), obj);
};