//数据映射函数
function hget(result,path,def){
var result = result || {};
(path || '').split('.').forEach(function(key){
if(key && (typeof result !== 'undefined')){
result = result[key];
}
});
if(typeof result === 'undefined'){
return def;
} else {
return result;
}
}
function hset(result,path, value){
if(typeof value === 'undefined'){
for(var k in path){
this[k]=path[k];
}
} else {
path = String(path || '').trim();
if(path){
var paths = path.split('.'),
last = paths.pop(),
data = result || {};
paths.forEach(function(key){
var type = typeof data[key];
if(type === 'object'){
data = data[key];
} else if(type === 'undefined'){
data = data[key] = {};
} else {
console.error('forbidden to set property[' + key + '] of [' + type + '] data');
}
});
data[last] = value;
}
}
return result;
}