func('profile-statistic-replies-value', 990);
, а на выходе получить объект profile.statistic.replies.value = 990;
var tree = node.getAttribute('data-staff').toString().split('-');
var end = {};
end[tree.pop()] = node;
while (tree.length) {
var obj = {};
obj[tree.pop()] = end;
end = obj;
}
console.log(end);
function deepObject(list, value) {
if (list.length === 0) {
return value;
}
var result = {};
result[list.pop()] = value;
return deepObject(list, result);
}
console.log(deepObject('profile-statistic-replies-value'.split('-'), 900));