Files
habitica/common/script/libs/dotSet.js
T
Blade Barringer 0a7b6b65e7 Revert "API v3 [WIP] (#6144)"
This reverts commit 28f2e9c356.
2016-05-23 07:53:14 -05:00

15 lines
354 B
JavaScript

import _ from 'lodash';
module.exports = function(obj, path, val) {
var arr;
arr = path.split('.');
return _.reduce(arr, (function(_this) {
return function(curr, next, index) {
if ((arr.length - 1) === index) {
curr[next] = val;
}
return curr[next] != null ? curr[next] : curr[next] = {};
};
})(this), obj);
};