Bug fix with ml and utils

master
Steve Nyemba 7 years ago
parent 7c2d581b17
commit 3ec024731f

@ -30,13 +30,14 @@ jx.ml.mapreduce = function(data,fn_map,fn_reduce){
}
__map[id].push(mvalue) ;
}//-- end of the emitter
if(data.constructor != Array){
jx.utils.patterns.visitor(data,function(id){
jx.utils.patterns.visitor(jx.utils.keys(data),function(id){
fn_map(data[id],emit) ;
});
}else{
jx.utils.patterns.visitor(data,function(i){
fn_map(data[i],emit) ;
jx.utils.patterns.visitor(data,function(row){
fn_map(row,emit) ;
});
}

@ -54,13 +54,8 @@ jx.utils.vector=function(key,rec){
* Extract keys from an associative array
* @param rec associative array
*/
jx.utils.keys=function(rec){
var keys = [] ;
for(var id in rec){
keys.push(id) ;
}
return keys ;
jx.utils.keys=function(rec){
return Object.keys(rec) ;
}//-- end jx.utils.keys
jx.utils.values = function(rec){
var r = []

Loading…
Cancel
Save